(t *testing.T)
| 191 | } |
| 192 | |
| 193 | func 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 | |
| 228 | func TestChecksStatus_SummarisingCheckRunAndStatusContextCountsByState(t *testing.T) { |
| 229 | t.Parallel() |
nothing calls this directly
no test coverage detected