MCPcopy
hub / github.com/cli/cli / TestChecksStatus_SummarisingCheckRunsAndStatusContexts

Function TestChecksStatus_SummarisingCheckRunsAndStatusContexts

api/pull_request_test.go:193–226  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

191}
192
193func TestChecksStatus_SummarisingCheckRunsAndStatusContexts(t *testing.T) {
194 t.Parallel()
195
196 // This might look a bit intimidating, but we're just inserting three nodes
197 // into the rollup, two completed check run nodes and one status context node.
198 payload := fmt.Sprintf(`
199 { "statusCheckRollup": { "nodes": [{ "commit": {
200 "statusCheckRollup": {
201 "contexts": {
202 "nodes": [
203 %s,
204 %s,
205 %s
206 ]
207 }
208 }
209 } }] } }
210 `,
211 completedCheckRunNode("SUCCESS"),
212 statusContextNode("PENDING"),
213 completedCheckRunNode("FAILURE"),
214 )
215
216 var pr PullRequest
217 require.NoError(t, json.Unmarshal([]byte(payload), &pr))
218
219 expectedChecksStatus := PullRequestChecksStatus{
220 Pending: 1,
221 Failing: 1,
222 Passing: 1,
223 Total: 3,
224 }
225 require.Equal(t, expectedChecksStatus, pr.ChecksStatus())
226}
227
228func TestChecksStatus_SummarisingCheckRunAndStatusContextCountsByState(t *testing.T) {
229 t.Parallel()

Callers

nothing calls this directly

Calls 4

ChecksStatusMethod · 0.95
completedCheckRunNodeFunction · 0.85
statusContextNodeFunction · 0.85
EqualMethod · 0.80

Tested by

no test coverage detected