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

Function TestCmdShowTaskDefaultsFromEnv

internal/app/show_test.go:164–187  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

162}
163
164func TestCmdShowTaskDefaultsFromEnv(t *testing.T) {
165 root, db := showListEditDB(t)
166 // `flow show task` (no arg) now resolves via reverse-lookup on
167 // $CLAUDE_CODE_SESSION_ID against tasks.session_id. Seed an
168 // in-progress task with a session_id and pin the env var so the
169 // lookup finds it.
170 const sid = "deadbeef-1111-4222-8333-444455556666"
171 insertTask(t, db, "env-task", "E", "backlog", "medium", filepath.Join(root, "x"), nil)
172 if _, err := db.Exec(
173 `UPDATE tasks SET session_id=?, session_started=?, status='in-progress' WHERE slug='env-task'`,
174 sid, flowdb.NowISO(),
175 ); err != nil {
176 t.Fatal(err)
177 }
178 t.Setenv("CLAUDE_CODE_SESSION_ID", sid)
179 out := captureStdout(t, func() {
180 if rc := cmdShow([]string{"task"}); rc != 0 {
181 t.Errorf("rc=%d", rc)
182 }
183 })
184 if !strings.Contains(out, "slug: env-task") {
185 t.Errorf("missing slug; out=%q", out)
186 }
187}
188
189func TestCmdShowTaskMissingDefault(t *testing.T) {
190 _, _ = showListEditDB(t)

Callers

nothing calls this directly

Calls 5

NowISOFunction · 0.92
showListEditDBFunction · 0.85
captureStdoutFunction · 0.85
cmdShowFunction · 0.85
insertTaskFunction · 0.70

Tested by

no test coverage detected