MCPcopy Create free account
hub / github.com/diillson/chatcli / TestTaskTracker_SetTasks_FullReplacement

Function TestTaskTracker_SetTasks_FullReplacement

cli/agent/task_tracker_test.go:94–114  ·  view source on GitHub ↗

TestTaskTracker_SetTasks pins the @todo write semantics: the full task list is replaced, statuses honored verbatim, and the CurrentTask cursor advances past any prefix of completed tasks.

(t *testing.T)

Source from the content-addressed store, hash-verified

92// task list is replaced, statuses honored verbatim, and the
93// CurrentTask cursor advances past any prefix of completed tasks.
94func TestTaskTracker_SetTasks_FullReplacement(t *testing.T) {
95 tracker := NewTaskTracker(zap.NewNop())
96 tracker.SetTasks([]TaskSpec{
97 {Description: "first", Status: TaskCompleted},
98 {Description: "second", Status: TaskCompleted},
99 {Description: "third", Status: TaskPending},
100 })
101 plan := tracker.GetPlan()
102 if plan == nil {
103 t.Fatal("plan must be created")
104 }
105 if len(plan.Tasks) != 3 {
106 t.Fatalf("expected 3 tasks, got %d", len(plan.Tasks))
107 }
108 if plan.CurrentTask != 2 {
109 t.Errorf("CurrentTask must advance past the two completed; got %d", plan.CurrentTask)
110 }
111 if plan.Tasks[0].Status != TaskCompleted {
112 t.Errorf("task[0] status: want completed, got %v", plan.Tasks[0].Status)
113 }
114}
115
116// TestTaskTracker_SetTasks_ExplicitInProgressFixesCurrent pins the
117// non-prefix case: when one task is explicitly in_progress, the

Callers

nothing calls this directly

Calls 4

SetTasksMethod · 0.95
GetPlanMethod · 0.95
NewTaskTrackerFunction · 0.85
ErrorfMethod · 0.80

Tested by

no test coverage detected