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

Function TestPRBodyFromPRD

internal/git/push_test.go:87–144  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

85}
86
87func 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}

Callers

nothing calls this directly

Calls 3

PRBodyFromPRDFunction · 0.85
RunMethod · 0.80
containsFunction · 0.70

Tested by

no test coverage detected