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

Function TestListTasksKindAll

internal/app/list_test.go:482–506  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

480}
481
482func TestListTasksKindAll(t *testing.T) {
483 setupFlowRoot(t)
484 db := openFlowDB(t)
485 wd := t.TempDir()
486 if err := flowdb.UpsertPlaybook(db, &flowdb.Playbook{Slug: "pb", Name: "PB", WorkDir: wd}); err != nil {
487 t.Fatal(err)
488 }
489 insertTask(t, db, "regular-1", "Regular 1", "in-progress", "high", wd, nil)
490 now := flowdb.NowISO()
491 if _, err := db.Exec(
492 `INSERT INTO tasks (slug, name, status, kind, playbook_slug, priority, work_dir, session_id, created_at, updated_at)
493 VALUES ('pb--run', 'r', 'in-progress', 'playbook_run', 'pb', 'medium', ?, ?, ?, ?)`,
494 wd, fakeSessionID("pb--run"), now, now,
495 ); err != nil {
496 t.Fatal(err)
497 }
498 out := captureShowStdout(t, func() {
499 if rc := cmdList([]string{"tasks", "--kind", "all"}); rc != 0 {
500 t.Fatal()
501 }
502 })
503 if !strings.Contains(out, "regular-1") || !strings.Contains(out, "pb--run") {
504 t.Errorf("--kind all should show both:\n%s", out)
505 }
506}
507
508func TestCmdListRuns(t *testing.T) {
509 setupFlowRoot(t)

Callers

nothing calls this directly

Calls 8

UpsertPlaybookFunction · 0.92
NowISOFunction · 0.92
setupFlowRootFunction · 0.85
openFlowDBFunction · 0.85
fakeSessionIDFunction · 0.85
captureShowStdoutFunction · 0.85
cmdListFunction · 0.85
insertTaskFunction · 0.70

Tested by

no test coverage detected