(t *testing.T)
| 85 | } |
| 86 | |
| 87 | func TestPRBodyFromPRD(t *testing.T) { |
| 88 | t.Run("includes summary and completed stories", func(t *testing.T) { |
| 89 | p := &prd.PRD{ |
| 90 | Project: "Test Project", |
| 91 | Description: "This is a test project description.", |
| 92 | UserStories: []prd.UserStory{ |
| 93 | {ID: "US-001", Title: "Config System", Passes: true}, |
| 94 | {ID: "US-002", Title: "Git Worktree Primitives", Passes: true}, |
| 95 | {ID: "US-003", Title: "Incomplete Story", Passes: false}, |
| 96 | }, |
| 97 | } |
| 98 | |
| 99 | body := PRBodyFromPRD(p) |
| 100 | |
| 101 | // Check summary section |
| 102 | if got := body; got == "" { |
| 103 | t.Fatal("PRBodyFromPRD() returned empty string") |
| 104 | } |
| 105 | if !contains(body, "## Summary") { |
| 106 | t.Error("body missing ## Summary header") |
| 107 | } |
| 108 | if !contains(body, "This is a test project description.") { |
| 109 | t.Error("body missing project description") |
| 110 | } |
| 111 | |
| 112 | // Check changes section |
| 113 | if !contains(body, "## Changes") { |
| 114 | t.Error("body missing ## Changes header") |
| 115 | } |
| 116 | if !contains(body, "US-001: Config System") { |
| 117 | t.Error("body missing completed story US-001") |
| 118 | } |
| 119 | if !contains(body, "US-002: Git Worktree Primitives") { |
| 120 | t.Error("body missing completed story US-002") |
| 121 | } |
| 122 | |
| 123 | // Incomplete stories should not be listed |
| 124 | if contains(body, "Incomplete Story") { |
| 125 | t.Error("body should not include incomplete stories") |
| 126 | } |
| 127 | }) |
| 128 | |
| 129 | t.Run("empty stories produces changes header only", func(t *testing.T) { |
| 130 | p := &prd.PRD{ |
| 131 | Project: "Empty Project", |
| 132 | Description: "No stories yet.", |
| 133 | UserStories: []prd.UserStory{}, |
| 134 | } |
| 135 | |
| 136 | body := PRBodyFromPRD(p) |
| 137 | if !contains(body, "## Summary") { |
| 138 | t.Error("body missing ## Summary header") |
| 139 | } |
| 140 | if !contains(body, "## Changes") { |
| 141 | t.Error("body missing ## Changes header") |
| 142 | } |
| 143 | }) |
| 144 | } |
nothing calls this directly
no test coverage detected