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

Function TestCmdAddPlaybookHappyPath

internal/app/playbook_test.go:11–39  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

9)
10
11func TestCmdAddPlaybookHappyPath(t *testing.T) {
12 root := setupFlowRoot(t)
13 wd := t.TempDir()
14
15 rc := cmdAdd([]string{"playbook", "Triage CS inbox", "--work-dir", wd, "--slug", "triage-cs"})
16 if rc != 0 {
17 t.Fatalf("cmdAdd rc=%d", rc)
18 }
19
20 db := openFlowDB(t)
21 pb, err := flowdb.GetPlaybook(db, "triage-cs")
22 if err != nil {
23 t.Fatalf("GetPlaybook: %v", err)
24 }
25 if pb.Name != "Triage CS inbox" {
26 t.Errorf("name: got %q", pb.Name)
27 }
28 if pb.WorkDir != wd {
29 t.Errorf("work_dir: got %q", pb.WorkDir)
30 }
31
32 briefPath := filepath.Join(root, "playbooks", "triage-cs", "brief.md")
33 if _, err := os.Stat(briefPath); err != nil {
34 t.Errorf("brief.md missing: %v", err)
35 }
36 if _, err := os.Stat(filepath.Join(root, "playbooks", "triage-cs", "updates")); err != nil {
37 t.Errorf("updates/ dir missing: %v", err)
38 }
39}
40
41func TestCmdAddPlaybookRequiresWorkDir(t *testing.T) {
42 setupFlowRoot(t)

Callers

nothing calls this directly

Calls 4

GetPlaybookFunction · 0.92
setupFlowRootFunction · 0.85
cmdAddFunction · 0.85
openFlowDBFunction · 0.85

Tested by

no test coverage detected