MCPcopy Create free account
hub / github.com/github/gh-aw / TestEvalUpdatePullRequestReplaced

Function TestEvalUpdatePullRequestReplaced

pkg/cli/outcome_eval_update_test.go:137–180  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

135}
136
137func TestEvalUpdatePullRequestReplaced(t *testing.T) {
138 old := outcomeUpdateGHAPIGet
139 t.Cleanup(func() {
140 outcomeUpdateGHAPIGet = old
141 })
142 outcomeUpdateGHAPIGet = func(endpoint string, repo string) (map[string]any, error) {
143 return map[string]any{
144 "title": "Maintainer rewrite",
145 "body": "Reworked body",
146 "state": "open",
147 "merged": false,
148 "base": map[string]any{"ref": "hotfix"},
149 "draft": false,
150 "head": map[string]any{"sha": "zzz999"},
151 }, nil
152 }
153
154 report := evalUpdatePullRequest(CreatedItemReport{
155 Type: "update_pull_request",
156 Number: 42,
157 Repo: "owner/repo",
158 BeforeState: map[string]any{
159 "title": "Old title",
160 "body_hash": mutableBodyHash("Old body"),
161 "state": "open",
162 "base": "main",
163 "draft": true,
164 "head_sha": "abc123",
165 },
166 AfterState: map[string]any{
167 "title": "New title",
168 "body_hash": mutableBodyHash("New body"),
169 "state": "open",
170 "base": "release",
171 "draft": false,
172 "head_sha": "def456",
173 },
174 }, "owner/repo")
175
176 assert.Equal(t, OutcomeRejected, report.Result)
177 assert.Equal(t, OutcomeStatusRejected, report.OutcomeStatus)
178 assert.Equal(t, EvidenceStrong, report.EvidenceStrength)
179 assert.Equal(t, "state_replaced", report.Signal)
180}
181
182func TestEvalRetainedUpdateMissingExecutionStateUsesEvidenceNone(t *testing.T) {
183 report := evalUpdateIssue(CreatedItemReport{

Callers

nothing calls this directly

Calls 2

evalUpdatePullRequestFunction · 0.85
mutableBodyHashFunction · 0.85

Tested by

no test coverage detected