TestCmdDoneCloseoutSweepIncludesProjectStep verifies that when the task is attached to a project, the close-out prompt includes the project-update step pointing at the project's updates/ directory.
(t *testing.T)
| 167 | // task is attached to a project, the close-out prompt includes the |
| 168 | // project-update step pointing at the project's updates/ directory. |
| 169 | func TestCmdDoneCloseoutSweepIncludesProjectStep(t *testing.T) { |
| 170 | setupFlowRoot(t) |
| 171 | calls := stubClaudeRunner(t, nil) |
| 172 | |
| 173 | wd := t.TempDir() |
| 174 | if rc := cmdAdd([]string{"project", "Some Proj", "--slug", "sp", "--work-dir", wd}); rc != 0 { |
| 175 | t.Fatalf("add project rc=%d", rc) |
| 176 | } |
| 177 | if rc := cmdAdd([]string{"task", "Has Proj", "--project", "sp"}); rc != 0 { |
| 178 | t.Fatalf("add task rc=%d", rc) |
| 179 | } |
| 180 | |
| 181 | db := openFlowDB(t) |
| 182 | if _, err := db.Exec( |
| 183 | `UPDATE tasks SET session_id=?, session_started=? WHERE slug=?`, |
| 184 | "hp-uuid", flowdb.NowISO(), "has-proj", |
| 185 | ); err != nil { |
| 186 | t.Fatalf("seed session_id: %v", err) |
| 187 | } |
| 188 | db.Close() |
| 189 | |
| 190 | if rc := cmdDone([]string{"has-proj"}); rc != 0 { |
| 191 | t.Fatalf("done rc=%d", rc) |
| 192 | } |
| 193 | if len(*calls) != 1 { |
| 194 | t.Fatalf("expected 1 sweep call, got %d", len(*calls)) |
| 195 | } |
| 196 | got := (*calls)[0].prompt |
| 197 | for _, want := range []string{ |
| 198 | "Project update", |
| 199 | "\"sp\"", |
| 200 | // Path is templatized off flowRoot() so the test environment's |
| 201 | // tempdir prefix appears here. Match the suffix only. |
| 202 | "/projects/sp/updates/", |
| 203 | } { |
| 204 | if !contains(got, want) { |
| 205 | t.Errorf("prompt missing %q", want) |
| 206 | } |
| 207 | } |
| 208 | } |
| 209 | |
| 210 | // TestCmdDoneCloseoutSweepSkipsProjectStepForFloating verifies that |
| 211 | // floating tasks (no project) get a prompt without any project-update |
nothing calls this directly
no test coverage detected