(t *testing.T)
| 2842 | } |
| 2843 | |
| 2844 | func TestManagerDeleteTask(t *testing.T) { |
| 2845 | t.Parallel() |
| 2846 | |
| 2847 | buildTask := func(id string, actor ActorContext) Task { |
| 2848 | now := time.Date(2026, 4, 14, 15, 0, 0, 0, time.UTC) |
| 2849 | return Task{ |
| 2850 | ID: id, |
| 2851 | Scope: ScopeGlobal, |
| 2852 | Title: id, |
| 2853 | Priority: DefaultPriority, |
| 2854 | MaxAttempts: 1, |
| 2855 | Status: TaskStatusReady, |
| 2856 | ApprovalPolicy: ApprovalPolicyNone, |
| 2857 | ApprovalState: ApprovalStateNotRequired, |
| 2858 | CreatedBy: actor.Actor, |
| 2859 | Origin: actor.Origin, |
| 2860 | CreatedAt: now, |
| 2861 | UpdatedAt: now, |
| 2862 | } |
| 2863 | } |
| 2864 | |
| 2865 | t.Run("ShouldRemoveAllActorTriageStateEntriesForTheDeletedTask", func(t *testing.T) { |
| 2866 | t.Parallel() |
| 2867 | |
| 2868 | actor := validActorContext() |
| 2869 | store := newDeleteTaskStore() |
| 2870 | manager := newTaskManagerForTest(t, store) |
| 2871 | record := buildTask("task-delete", actor) |
| 2872 | now := time.Date(2026, 4, 14, 16, 0, 0, 0, time.UTC) |
| 2873 | |
| 2874 | if err := store.CreateTask(context.Background(), record); err != nil { |
| 2875 | t.Fatalf("CreateTask() error = %v", err) |
| 2876 | } |
| 2877 | if err := store.UpsertTaskTriageState(context.Background(), TriageState{ |
| 2878 | TaskID: record.ID, |
| 2879 | Actor: actor.Actor, |
| 2880 | Read: true, |
| 2881 | LastSeenActivityAt: now, |
| 2882 | UpdatedAt: now, |
| 2883 | }); err != nil { |
| 2884 | t.Fatalf("UpsertTaskTriageState(primary actor) error = %v", err) |
| 2885 | } |
| 2886 | if err := store.UpsertTaskTriageState(context.Background(), TriageState{ |
| 2887 | TaskID: record.ID, |
| 2888 | Actor: ActorIdentity{ |
| 2889 | Kind: ActorKindHuman, |
| 2890 | Ref: "user-2", |
| 2891 | }, |
| 2892 | Archived: true, |
| 2893 | LastSeenActivityAt: now, |
| 2894 | UpdatedAt: now, |
| 2895 | }); err != nil { |
| 2896 | t.Fatalf("UpsertTaskTriageState(second actor) error = %v", err) |
| 2897 | } |
| 2898 | |
| 2899 | if err := manager.DeleteTask(context.Background(), record.ID, actor); err != nil { |
| 2900 | t.Fatalf("DeleteTask() error = %v", err) |
| 2901 | } |
nothing calls this directly
no test coverage detected