createTestPRDMd creates a markdown PRD file for testing.
(t *testing.T, dir string, stories []UserStory)
| 9 | |
| 10 | // createTestPRDMd creates a markdown PRD file for testing. |
| 11 | func 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 | |
| 35 | func TestNewWatcher(t *testing.T) { |
| 36 | tmpDir := t.TempDir() |
no outgoing calls
no test coverage detected