MCPcopy Create free account
hub / github.com/MiniCodeMonkey/chief / createTestPRDMd

Function createTestPRDMd

internal/prd/watcher_test.go:11–33  ·  view source on GitHub ↗

createTestPRDMd creates a markdown PRD file for testing.

(t *testing.T, dir string, stories []UserStory)

Source from the content-addressed store, hash-verified

9
10// createTestPRDMd creates a markdown PRD file for testing.
11func createTestPRDMd(t *testing.T, dir string, stories []UserStory) string {
12 t.Helper()
13 prdPath := filepath.Join(dir, "prd.md")
14
15 md := "# Test\n\n"
16 for _, s := range stories {
17 md += "### " + s.ID + ": " + s.Title + "\n"
18 if s.Passes {
19 md += "**Status:** done\n"
20 } else if s.InProgress {
21 md += "**Status:** in-progress\n"
22 }
23 if s.Description != "" {
24 md += "**Description:** " + s.Description + "\n"
25 }
26 md += "- [ ] criterion\n\n"
27 }
28
29 if err := os.WriteFile(prdPath, []byte(md), 0644); err != nil {
30 t.Fatalf("Failed to write test PRD: %v", err)
31 }
32 return prdPath
33}
34
35func TestNewWatcher(t *testing.T) {
36 tmpDir := t.TempDir()

Callers 5

TestNewWatcherFunction · 0.85
TestWatcherStartFunction · 0.85
TestWatcherStopFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected