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

Function TestParseMarkdownPRDFromString_Normal

internal/prd/markdown_test.go:9–104  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

7)
8
9func TestParseMarkdownPRDFromString_Normal(t *testing.T) {
10 md := `# PRD: My Test Project
11
12A sample project for testing.
13
14## User Stories
15
16### US-001: Setup Project
17As a developer, I need a properly structured project.
18
19**Priority:** 1
20**Status:** done
21
22- [x] Create project structure
23- [x] Add dependencies
24
25### US-002: Add Feature
26**Description:** As a user, I want a new feature.
27
28**Status:** in-progress
29
30- [ ] Feature works correctly
31- [ ] Tests pass
32
33### US-003: Final Polish
34Some prose description here.
35
36- [ ] Polish the UI
37- [ ] Write docs
38`
39 p, err := ParseMarkdownPRDFromString(md)
40 if err != nil {
41 t.Fatalf("ParseMarkdownPRDFromString() error = %v", err)
42 }
43
44 if p.Project != "My Test Project" {
45 t.Errorf("Project = %q, want %q", p.Project, "My Test Project")
46 }
47 if p.Description != "A sample project for testing." {
48 t.Errorf("Description = %q, want %q", p.Description, "A sample project for testing.")
49 }
50 if len(p.UserStories) != 3 {
51 t.Fatalf("len(UserStories) = %d, want 3", len(p.UserStories))
52 }
53
54 // Story 1: done
55 s1 := p.UserStories[0]
56 if s1.ID != "US-001" {
57 t.Errorf("s1.ID = %q, want %q", s1.ID, "US-001")
58 }
59 if s1.Title != "Setup Project" {
60 t.Errorf("s1.Title = %q, want %q", s1.Title, "Setup Project")
61 }
62 if !s1.Passes {
63 t.Error("s1.Passes = false, want true")
64 }
65 if s1.InProgress {
66 t.Error("s1.InProgress = true, want false")

Callers

nothing calls this directly

Calls 1

Tested by

no test coverage detected