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

Function TestCmdEditPlaybook

internal/app/edit_test.go:235–259  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

233}
234
235func TestCmdEditPlaybook(t *testing.T) {
236 root := setupFlowRoot(t)
237 wd := t.TempDir()
238 if rc := cmdAdd([]string{"playbook", "P", "--slug", "p", "--work-dir", wd}); rc != 0 {
239 t.Fatal()
240 }
241 t.Setenv("EDITOR", "/usr/bin/true")
242 if rc := cmdEdit([]string{"p"}); rc != 0 {
243 t.Errorf("rc=%d", rc)
244 }
245 briefPath := filepath.Join(root, "playbooks", "p", "brief.md")
246 if _, err := os.Stat(briefPath); err != nil {
247 t.Errorf("brief.md missing: %v", err)
248 }
249
250 // updated_at should be bumped — verify the row's updated_at is recent.
251 db := openFlowDB(t)
252 pb, err := flowdb.GetPlaybook(db, "p")
253 if err != nil {
254 t.Fatal(err)
255 }
256 if pb.UpdatedAt == "" {
257 t.Errorf("UpdatedAt empty")
258 }
259}

Callers

nothing calls this directly

Calls 5

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

Tested by

no test coverage detected