MCPcopy Create free account
hub / github.com/Facets-cloud/flow / TestCmdDoneHappyPath

Function TestCmdDoneHappyPath

internal/app/done_test.go:31–58  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

29}
30
31func TestCmdDoneHappyPath(t *testing.T) {
32 setupFlowRoot(t)
33 stubClaudeRunner(t, nil)
34 if rc := cmdAdd([]string{"task", "Some Task"}); rc != 0 {
35 t.Fatalf("add rc=%d", rc)
36 }
37 // Session-id invariant: done requires a session_id. Pre-seed one
38 // so the close-out is legal.
39 db := openFlowDB(t)
40 if _, err := db.Exec(
41 `UPDATE tasks SET session_id=?, session_started=? WHERE slug='some-task'`,
42 fakeSessionID("some-task"), flowdb.NowISO(),
43 ); err != nil {
44 t.Fatal(err)
45 }
46 db.Close()
47 if rc := cmdDone([]string{"some-task"}); rc != 0 {
48 t.Fatalf("done rc=%d", rc)
49 }
50 db = openFlowDB(t)
51 task, err := flowdb.GetTask(db, "some-task")
52 if err != nil {
53 t.Fatal(err)
54 }
55 if task.Status != "done" {
56 t.Errorf("status: got %q, want done", task.Status)
57 }
58}
59
60func TestCmdDoneUnknownRef(t *testing.T) {
61 setupFlowRoot(t)

Callers

nothing calls this directly

Calls 8

NowISOFunction · 0.92
GetTaskFunction · 0.92
setupFlowRootFunction · 0.85
stubClaudeRunnerFunction · 0.85
cmdAddFunction · 0.85
openFlowDBFunction · 0.85
fakeSessionIDFunction · 0.85
cmdDoneFunction · 0.85

Tested by

no test coverage detected