(t *testing.T)
| 9 | ) |
| 10 | |
| 11 | func 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 | |
| 41 | func TestCmdAddPlaybookRequiresWorkDir(t *testing.T) { |
| 42 | setupFlowRoot(t) |
nothing calls this directly
no test coverage detected