(pages, comparisons = [])
| 55 | } |
| 56 | |
| 57 | function client(pages, comparisons = []) { |
| 58 | const calls = []; |
| 59 | const comparisonCalls = []; |
| 60 | return { |
| 61 | calls, |
| 62 | comparisonCalls, |
| 63 | rest: { |
| 64 | repos: { |
| 65 | async compareCommitsWithBasehead(options) { |
| 66 | comparisonCalls.push(options); |
| 67 | assert.strictEqual(options.owner, VARIABLES.owner); |
| 68 | assert.strictEqual(options.repo, VARIABLES.repo); |
| 69 | assert.strictEqual(options.per_page, 100); |
| 70 | assert.strictEqual(options.page, comparisonCalls.length); |
| 71 | assert.ok(comparisonCalls.length <= comparisons.length, "unexpected comparison call"); |
| 72 | const data = comparisons[comparisonCalls.length - 1]; |
| 73 | if (data instanceof Error) throw data; |
| 74 | return { data }; |
| 75 | }, |
| 76 | }, |
| 77 | }, |
| 78 | async graphql(query, variables) { |
| 79 | assert.ok(query.includes("commits(first: 100, after: $cursor)")); |
| 80 | assert.ok(!query.includes("body")); |
| 81 | assert.deepStrictEqual( |
| 82 | { owner: variables.owner, repo: variables.repo, number: variables.number }, |
| 83 | VARIABLES |
| 84 | ); |
| 85 | calls.push(variables); |
| 86 | assert.ok(calls.length <= pages.length, "unexpected API call"); |
| 87 | const response = pages[calls.length - 1]; |
| 88 | if (response instanceof Error) throw response; |
| 89 | return response; |
| 90 | }, |
| 91 | }; |
| 92 | } |
| 93 | |
| 94 | function reporter() { |
| 95 | const messages = { errors: [], failures: [], info: [] }; |
no outgoing calls
no test coverage detected