From 3ffa072a40e4cb51c53c2529d67a9ba3b95ce77e Mon Sep 17 00:00:00 2001 From: James Moore Date: Fri, 8 Mar 2024 11:08:53 -0800 Subject: [PATCH 1/9] convert batch request to single requests --- dist/index.js | 35 +++++++++++++++++++++++++++-------- src/github.js | 33 ++++++++++++++++++++++++++------- src/index.js | 2 +- 3 files changed, 54 insertions(+), 16 deletions(-) diff --git a/dist/index.js b/dist/index.js index e5e173b..8d61dcd 100644 --- a/dist/index.js +++ b/dist/index.js @@ -17519,13 +17519,32 @@ async function assign_reviewers(reviewers) { const [ teams_with_prefix, individuals ] = partition(reviewers, (reviewer) => reviewer.startsWith('team:')); const teams = teams_with_prefix.map((team_with_prefix) => team_with_prefix.replace('team:', '')); - return octokit.pulls.requestReviewers({ - owner: context.repo.owner, - repo: context.repo.repo, - pull_number: context.payload.pull_request.number, - reviewers: individuals, - team_reviewers: teams, - }); + const request_review_responses = []; + + // Github's requestReviewers API will fail to add all reviewers if any of the aliases are not collaborators. + // We therefore make each call individually so that we add all reviewers that are collaborators, + // and log failure for aliases that no longer have access. + request_review_responses.push(...teams.map((team) => { + return octokit.pulls.requestReviewers({ + owner: context.repo.owner, + repo: context.repo.repo, + pull_number: context.payload.pull_request.number, + reviewers: [], + team_reviewers: [ ...team ], + }).catch((error) => core.error(`Team: ${team} failed to be added with error: ${error}`)); + })); + + request_review_responses.push(...individuals.map((login) => { + return octokit.pulls.requestReviewers({ + owner: context.repo.owner, + repo: context.repo.repo, + pull_number: context.payload.pull_request.number, + reviewers: [ ...login ], + team_reviewers: [ ], + }).catch((error) => core.error(`Individual ${login} failed to be added with error: ${error}`)); + })); + + return request_review_responses; } /* Private */ @@ -17669,7 +17688,7 @@ async function run() { if (reviewers.length > 0) { core.info(`Requesting review to ${reviewers.join(', ')}`); - await github.assign_reviewers(reviewers); + await Promise.all(github.assign_reviewers(reviewers)); } else { core.info('No new reviewers to assign to PR'); } diff --git a/src/github.js b/src/github.js index 19540da..d25b75c 100644 --- a/src/github.js +++ b/src/github.js @@ -170,13 +170,32 @@ async function assign_reviewers(reviewers) { const [ teams_with_prefix, individuals ] = partition(reviewers, (reviewer) => reviewer.startsWith('team:')); const teams = teams_with_prefix.map((team_with_prefix) => team_with_prefix.replace('team:', '')); - return octokit.pulls.requestReviewers({ - owner: context.repo.owner, - repo: context.repo.repo, - pull_number: context.payload.pull_request.number, - reviewers: individuals, - team_reviewers: teams, - }); + const request_review_responses = []; + + // Github's requestReviewers API will fail to add all reviewers if any of the aliases are not collaborators. + // We therefore make each call individually so that we add all reviewers that are collaborators, + // and log failure for aliases that no longer have access. + request_review_responses.push(...teams.map((team) => { + return octokit.pulls.requestReviewers({ + owner: context.repo.owner, + repo: context.repo.repo, + pull_number: context.payload.pull_request.number, + reviewers: [], + team_reviewers: [ ...team ], + }).catch((error) => core.error(`Team: ${team} failed to be added with error: ${error}`)); + })); + + request_review_responses.push(...individuals.map((login) => { + return octokit.pulls.requestReviewers({ + owner: context.repo.owner, + repo: context.repo.repo, + pull_number: context.payload.pull_request.number, + reviewers: [ ...login ], + team_reviewers: [ ], + }).catch((error) => core.error(`Individual ${login} failed to be added with error: ${error}`)); + })); + + return request_review_responses; } /* Private */ diff --git a/src/index.js b/src/index.js index ece7a0e..6ae42f0 100644 --- a/src/index.js +++ b/src/index.js @@ -80,7 +80,7 @@ async function run() { if (reviewers.length > 0) { core.info(`Requesting review to ${reviewers.join(', ')}`); - await github.assign_reviewers(reviewers); + await Promise.all(github.assign_reviewers(reviewers)); } else { core.info('No new reviewers to assign to PR'); } From b6158543b82a995c799d8100d8d167f380d5ff24 Mon Sep 17 00:00:00 2001 From: James Moore Date: Fri, 8 Mar 2024 11:20:36 -0800 Subject: [PATCH 2/9] change format slightly --- dist/index.js | 16 ++++++++-------- src/github.js | 16 ++++++++-------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/dist/index.js b/dist/index.js index 8d61dcd..fe62e5f 100644 --- a/dist/index.js +++ b/dist/index.js @@ -17524,25 +17524,25 @@ async function assign_reviewers(reviewers) { // Github's requestReviewers API will fail to add all reviewers if any of the aliases are not collaborators. // We therefore make each call individually so that we add all reviewers that are collaborators, // and log failure for aliases that no longer have access. - request_review_responses.push(...teams.map((team) => { - return octokit.pulls.requestReviewers({ + teams.forEach((team) => { + request_review_responses.add(octokit.pulls.requestReviewers({ owner: context.repo.owner, repo: context.repo.repo, pull_number: context.payload.pull_request.number, reviewers: [], team_reviewers: [ ...team ], - }).catch((error) => core.error(`Team: ${team} failed to be added with error: ${error}`)); - })); + }).catch((error) => core.error(`Team: ${team} failed to be added with error: ${error}`))); + }); - request_review_responses.push(...individuals.map((login) => { - return octokit.pulls.requestReviewers({ + individuals.forEach((login) => { + request_review_responses.add(octokit.pulls.requestReviewers({ owner: context.repo.owner, repo: context.repo.repo, pull_number: context.payload.pull_request.number, reviewers: [ ...login ], team_reviewers: [ ], - }).catch((error) => core.error(`Individual ${login} failed to be added with error: ${error}`)); - })); + }).catch((error) => core.error(`Individual ${login} failed to be added with error: ${error}`))); + }); return request_review_responses; } diff --git a/src/github.js b/src/github.js index d25b75c..2608e63 100644 --- a/src/github.js +++ b/src/github.js @@ -175,25 +175,25 @@ async function assign_reviewers(reviewers) { // Github's requestReviewers API will fail to add all reviewers if any of the aliases are not collaborators. // We therefore make each call individually so that we add all reviewers that are collaborators, // and log failure for aliases that no longer have access. - request_review_responses.push(...teams.map((team) => { - return octokit.pulls.requestReviewers({ + teams.forEach((team) => { + request_review_responses.add(octokit.pulls.requestReviewers({ owner: context.repo.owner, repo: context.repo.repo, pull_number: context.payload.pull_request.number, reviewers: [], team_reviewers: [ ...team ], - }).catch((error) => core.error(`Team: ${team} failed to be added with error: ${error}`)); - })); + }).catch((error) => core.error(`Team: ${team} failed to be added with error: ${error}`))); + }); - request_review_responses.push(...individuals.map((login) => { - return octokit.pulls.requestReviewers({ + individuals.forEach((login) => { + request_review_responses.add(octokit.pulls.requestReviewers({ owner: context.repo.owner, repo: context.repo.repo, pull_number: context.payload.pull_request.number, reviewers: [ ...login ], team_reviewers: [ ], - }).catch((error) => core.error(`Individual ${login} failed to be added with error: ${error}`)); - })); + }).catch((error) => core.error(`Individual ${login} failed to be added with error: ${error}`))); + }); return request_review_responses; } From 5269f987294d50197d0400370ba542690c44152f Mon Sep 17 00:00:00 2001 From: James Moore Date: Fri, 8 Mar 2024 11:22:14 -0800 Subject: [PATCH 3/9] convert to push --- dist/index.js | 4 ++-- src/github.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/dist/index.js b/dist/index.js index fe62e5f..f74d3ff 100644 --- a/dist/index.js +++ b/dist/index.js @@ -17525,7 +17525,7 @@ async function assign_reviewers(reviewers) { // We therefore make each call individually so that we add all reviewers that are collaborators, // and log failure for aliases that no longer have access. teams.forEach((team) => { - request_review_responses.add(octokit.pulls.requestReviewers({ + request_review_responses.push(octokit.pulls.requestReviewers({ owner: context.repo.owner, repo: context.repo.repo, pull_number: context.payload.pull_request.number, @@ -17535,7 +17535,7 @@ async function assign_reviewers(reviewers) { }); individuals.forEach((login) => { - request_review_responses.add(octokit.pulls.requestReviewers({ + request_review_responses.push(octokit.pulls.requestReviewers({ owner: context.repo.owner, repo: context.repo.repo, pull_number: context.payload.pull_request.number, diff --git a/src/github.js b/src/github.js index 2608e63..fb3f730 100644 --- a/src/github.js +++ b/src/github.js @@ -176,7 +176,7 @@ async function assign_reviewers(reviewers) { // We therefore make each call individually so that we add all reviewers that are collaborators, // and log failure for aliases that no longer have access. teams.forEach((team) => { - request_review_responses.add(octokit.pulls.requestReviewers({ + request_review_responses.push(octokit.pulls.requestReviewers({ owner: context.repo.owner, repo: context.repo.repo, pull_number: context.payload.pull_request.number, @@ -186,7 +186,7 @@ async function assign_reviewers(reviewers) { }); individuals.forEach((login) => { - request_review_responses.add(octokit.pulls.requestReviewers({ + request_review_responses.push(octokit.pulls.requestReviewers({ owner: context.repo.owner, repo: context.repo.repo, pull_number: context.payload.pull_request.number, From edffb6644323d6cc48caeaf91f9f40f8b03c4212 Mon Sep 17 00:00:00 2001 From: James Moore Date: Fri, 8 Mar 2024 11:30:26 -0800 Subject: [PATCH 4/9] update format, add logs --- dist/index.js | 4 ++-- src/github.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/dist/index.js b/dist/index.js index f74d3ff..79d589e 100644 --- a/dist/index.js +++ b/dist/index.js @@ -17529,7 +17529,6 @@ async function assign_reviewers(reviewers) { owner: context.repo.owner, repo: context.repo.repo, pull_number: context.payload.pull_request.number, - reviewers: [], team_reviewers: [ ...team ], }).catch((error) => core.error(`Team: ${team} failed to be added with error: ${error}`))); }); @@ -17540,10 +17539,11 @@ async function assign_reviewers(reviewers) { repo: context.repo.repo, pull_number: context.payload.pull_request.number, reviewers: [ ...login ], - team_reviewers: [ ], }).catch((error) => core.error(`Individual ${login} failed to be added with error: ${error}`))); }); + core.info(JSON.stringify(request_review_responses)); + return request_review_responses; } diff --git a/src/github.js b/src/github.js index fb3f730..389e336 100644 --- a/src/github.js +++ b/src/github.js @@ -180,7 +180,6 @@ async function assign_reviewers(reviewers) { owner: context.repo.owner, repo: context.repo.repo, pull_number: context.payload.pull_request.number, - reviewers: [], team_reviewers: [ ...team ], }).catch((error) => core.error(`Team: ${team} failed to be added with error: ${error}`))); }); @@ -191,10 +190,11 @@ async function assign_reviewers(reviewers) { repo: context.repo.repo, pull_number: context.payload.pull_request.number, reviewers: [ ...login ], - team_reviewers: [ ], }).catch((error) => core.error(`Individual ${login} failed to be added with error: ${error}`))); }); + core.info(JSON.stringify(request_review_responses)); + return request_review_responses; } From 3d198d8ed267587e5fde071a2d1f099cf01f9b6a Mon Sep 17 00:00:00 2001 From: James Moore Date: Fri, 8 Mar 2024 11:41:54 -0800 Subject: [PATCH 5/9] move promise.all to github --- dist/index.js | 7 ++++--- src/github.js | 5 +++-- src/index.js | 2 +- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/dist/index.js b/dist/index.js index 79d589e..d1f0187 100644 --- a/dist/index.js +++ b/dist/index.js @@ -17522,6 +17522,8 @@ async function assign_reviewers(reviewers) { const request_review_responses = []; // Github's requestReviewers API will fail to add all reviewers if any of the aliases are not collaborators. + // Github also does not support a batch call to determine which aliases in the list are not collaborators. + // We therefore make each call individually so that we add all reviewers that are collaborators, // and log failure for aliases that no longer have access. teams.forEach((team) => { @@ -17543,8 +17545,7 @@ async function assign_reviewers(reviewers) { }); core.info(JSON.stringify(request_review_responses)); - - return request_review_responses; + return Promise.all(request_review_responses); } /* Private */ @@ -17688,7 +17689,7 @@ async function run() { if (reviewers.length > 0) { core.info(`Requesting review to ${reviewers.join(', ')}`); - await Promise.all(github.assign_reviewers(reviewers)); + await github.assign_reviewers(reviewers); } else { core.info('No new reviewers to assign to PR'); } diff --git a/src/github.js b/src/github.js index 389e336..4d1c53b 100644 --- a/src/github.js +++ b/src/github.js @@ -173,6 +173,8 @@ async function assign_reviewers(reviewers) { const request_review_responses = []; // Github's requestReviewers API will fail to add all reviewers if any of the aliases are not collaborators. + // Github also does not support a batch call to determine which aliases in the list are not collaborators. + // We therefore make each call individually so that we add all reviewers that are collaborators, // and log failure for aliases that no longer have access. teams.forEach((team) => { @@ -194,8 +196,7 @@ async function assign_reviewers(reviewers) { }); core.info(JSON.stringify(request_review_responses)); - - return request_review_responses; + return Promise.all(request_review_responses); } /* Private */ diff --git a/src/index.js b/src/index.js index 6ae42f0..ece7a0e 100644 --- a/src/index.js +++ b/src/index.js @@ -80,7 +80,7 @@ async function run() { if (reviewers.length > 0) { core.info(`Requesting review to ${reviewers.join(', ')}`); - await Promise.all(github.assign_reviewers(reviewers)); + await github.assign_reviewers(reviewers); } else { core.info('No new reviewers to assign to PR'); } From 2750747920dbb2fce997e9ac27f8ec0a4a8e64b4 Mon Sep 17 00:00:00 2001 From: James Moore Date: Fri, 8 Mar 2024 11:50:09 -0800 Subject: [PATCH 6/9] try not passing as list --- dist/index.js | 3 +-- src/github.js | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/dist/index.js b/dist/index.js index d1f0187..0d93ca2 100644 --- a/dist/index.js +++ b/dist/index.js @@ -17531,7 +17531,7 @@ async function assign_reviewers(reviewers) { owner: context.repo.owner, repo: context.repo.repo, pull_number: context.payload.pull_request.number, - team_reviewers: [ ...team ], + team_reviewers: team, }).catch((error) => core.error(`Team: ${team} failed to be added with error: ${error}`))); }); @@ -17544,7 +17544,6 @@ async function assign_reviewers(reviewers) { }).catch((error) => core.error(`Individual ${login} failed to be added with error: ${error}`))); }); - core.info(JSON.stringify(request_review_responses)); return Promise.all(request_review_responses); } diff --git a/src/github.js b/src/github.js index 4d1c53b..e6f51a6 100644 --- a/src/github.js +++ b/src/github.js @@ -182,7 +182,7 @@ async function assign_reviewers(reviewers) { owner: context.repo.owner, repo: context.repo.repo, pull_number: context.payload.pull_request.number, - team_reviewers: [ ...team ], + team_reviewers: team, }).catch((error) => core.error(`Team: ${team} failed to be added with error: ${error}`))); }); @@ -195,7 +195,6 @@ async function assign_reviewers(reviewers) { }).catch((error) => core.error(`Individual ${login} failed to be added with error: ${error}`))); }); - core.info(JSON.stringify(request_review_responses)); return Promise.all(request_review_responses); } From 36e0bb9d3945dc420c5b1a8c302727621602c0ce Mon Sep 17 00:00:00 2001 From: James Moore Date: Fri, 8 Mar 2024 11:55:05 -0800 Subject: [PATCH 7/9] doh use single item array --- dist/index.js | 4 ++-- src/github.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/dist/index.js b/dist/index.js index 0d93ca2..9527000 100644 --- a/dist/index.js +++ b/dist/index.js @@ -17531,7 +17531,7 @@ async function assign_reviewers(reviewers) { owner: context.repo.owner, repo: context.repo.repo, pull_number: context.payload.pull_request.number, - team_reviewers: team, + team_reviewers: [ team ], }).catch((error) => core.error(`Team: ${team} failed to be added with error: ${error}`))); }); @@ -17540,7 +17540,7 @@ async function assign_reviewers(reviewers) { owner: context.repo.owner, repo: context.repo.repo, pull_number: context.payload.pull_request.number, - reviewers: [ ...login ], + reviewers: [ login ], }).catch((error) => core.error(`Individual ${login} failed to be added with error: ${error}`))); }); diff --git a/src/github.js b/src/github.js index e6f51a6..8bec52b 100644 --- a/src/github.js +++ b/src/github.js @@ -182,7 +182,7 @@ async function assign_reviewers(reviewers) { owner: context.repo.owner, repo: context.repo.repo, pull_number: context.payload.pull_request.number, - team_reviewers: team, + team_reviewers: [ team ], }).catch((error) => core.error(`Team: ${team} failed to be added with error: ${error}`))); }); @@ -191,7 +191,7 @@ async function assign_reviewers(reviewers) { owner: context.repo.owner, repo: context.repo.repo, pull_number: context.payload.pull_request.number, - reviewers: [ ...login ], + reviewers: [ login ], }).catch((error) => core.error(`Individual ${login} failed to be added with error: ${error}`))); }); From 9774317567f7d06dee727f69674d4b649d4824e4 Mon Sep 17 00:00:00 2001 From: James Moore Date: Fri, 8 Mar 2024 12:01:27 -0800 Subject: [PATCH 8/9] change to allSettled to not interrupt on single failure --- dist/index.js | 2 +- src/github.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dist/index.js b/dist/index.js index 9527000..d8876ae 100644 --- a/dist/index.js +++ b/dist/index.js @@ -17544,7 +17544,7 @@ async function assign_reviewers(reviewers) { }).catch((error) => core.error(`Individual ${login} failed to be added with error: ${error}`))); }); - return Promise.all(request_review_responses); + return Promise.allSettled(request_review_responses); } /* Private */ diff --git a/src/github.js b/src/github.js index 8bec52b..8d0bb6a 100644 --- a/src/github.js +++ b/src/github.js @@ -195,7 +195,7 @@ async function assign_reviewers(reviewers) { }).catch((error) => core.error(`Individual ${login} failed to be added with error: ${error}`))); }); - return Promise.all(request_review_responses); + return Promise.allSettled(request_review_responses); } /* Private */ From 7ff981e1aea331a279c27446520d7235a4804b59 Mon Sep 17 00:00:00 2001 From: James Moore Date: Fri, 8 Mar 2024 14:35:01 -0800 Subject: [PATCH 9/9] add tests, nit update to error printout --- dist/index.js | 2 +- src/github.js | 2 +- test/github.test.js | 130 ++++++++++++++++++++++++++++++++++++++++++-- 3 files changed, 127 insertions(+), 7 deletions(-) diff --git a/dist/index.js b/dist/index.js index d8876ae..a190e25 100644 --- a/dist/index.js +++ b/dist/index.js @@ -17541,7 +17541,7 @@ async function assign_reviewers(reviewers) { repo: context.repo.repo, pull_number: context.payload.pull_request.number, reviewers: [ login ], - }).catch((error) => core.error(`Individual ${login} failed to be added with error: ${error}`))); + }).catch((error) => core.error(`Individual: ${login} failed to be added with error: ${error}`))); }); return Promise.allSettled(request_review_responses); diff --git a/src/github.js b/src/github.js index 8d0bb6a..3f2b051 100644 --- a/src/github.js +++ b/src/github.js @@ -192,7 +192,7 @@ async function assign_reviewers(reviewers) { repo: context.repo.repo, pull_number: context.payload.pull_request.number, reviewers: [ login ], - }).catch((error) => core.error(`Individual ${login} failed to be added with error: ${error}`))); + }).catch((error) => core.error(`Individual: ${login} failed to be added with error: ${error}`))); }); return Promise.allSettled(request_review_responses); diff --git a/test/github.test.js b/test/github.test.js index 0ebba1d..85a3a73 100644 --- a/test/github.test.js +++ b/test/github.test.js @@ -279,10 +279,10 @@ describe('github', function() { }); describe('assign_reviewers()', function() { - const spy = sinon.spy(); + const stub = sinon.stub(); const octokit = { pulls: { - requestReviewers: spy, + requestReviewers: stub, }, }; @@ -291,26 +291,146 @@ describe('github', function() { restoreModule = rewired_github.__set__('octokit_cache', octokit); }); afterEach(function() { + stub.reset(); restoreModule(); }); - it('assigns reviewers', async function() { + it('assigns reviewers - mixed success', async function() { + stub.onFirstCall().resolves({}); + stub.onSecondCall().resolves({}); + stub.onThirdCall().resolves({}); + const reviewers = [ 'mario', 'princess-peach', 'team:koopa-troop' ]; await rewired_github.assign_reviewers(reviewers); - expect(spy.calledOnce).to.be.true; - expect(spy.lastCall.args[0]).to.deep.equal({ + expect(stub.calledThrice).to.be.true; + expect(stub.firstCall.args[0]).to.deep.equal({ + owner: 'necojackarc', + pull_number: 18, + repo: 'auto-request-review', + team_reviewers: [ + 'koopa-troop', + ], + }); + + expect(stub.secondCall.args[0]).to.deep.equal({ owner: 'necojackarc', pull_number: 18, repo: 'auto-request-review', reviewers: [ 'mario', + ], + }); + + expect(stub.thirdCall.args[0]).to.deep.equal({ + owner: 'necojackarc', + pull_number: 18, + repo: 'auto-request-review', + reviewers: [ + 'princess-peach', + ], + }); + }); + + it('assigns reviewers - continues after failure individual', async function() { + stub.onFirstCall().resolves({}); + let isResolved = false; + let isRejected = false; + const error = new Error('Alias is not a collaborator'); + const failedNetworkCall = Promise.reject(error).then( + function(value) { + isResolved = true; return value; + }, + function(error) { + isRejected = true; throw error; + } + ); + stub.onSecondCall().returns(failedNetworkCall); + stub.onThirdCall().resolves({}); + + const reviewers = [ 'team:super_marios', 'princess-peach', 'luigi' ]; + await rewired_github.assign_reviewers(reviewers); + + expect(stub.calledThrice).to.be.true; + expect(stub.firstCall.args[0]).to.deep.equal({ + owner: 'necojackarc', + pull_number: 18, + repo: 'auto-request-review', + team_reviewers: [ + 'super_marios', + ], + }); + + expect(stub.secondCall.args[0]).to.deep.equal({ + owner: 'necojackarc', + pull_number: 18, + repo: 'auto-request-review', + reviewers: [ 'princess-peach', ], + }); + expect(isRejected).to.be.true; + expect(isResolved).to.be.false; + + expect(stub.thirdCall.args[0]).to.deep.equal({ + owner: 'necojackarc', + pull_number: 18, + repo: 'auto-request-review', + reviewers: [ + 'luigi', + ], + }); + }); + + it('assigns reviewers - continues after failure team', async function() { + let isResolved = false; + let isRejected = false; + const error = new Error('Alias is not a collaborator'); + const failedNetworkCall = Promise.reject(error).then( + function(value) { + isResolved = true; return value; + }, + function(error) { + isRejected = true; throw error; + } + ); + stub.onFirstCall().returns(failedNetworkCall); + stub.onSecondCall().resolves({}); + stub.onThirdCall().resolves({}); + + const reviewers = [ 'team:toads', 'team:koopa-troop', 'mario' ]; + await rewired_github.assign_reviewers(reviewers); + + expect(stub.calledThrice).to.be.true; + + expect(stub.firstCall.args[0]).to.deep.equal({ + owner: 'necojackarc', + pull_number: 18, + repo: 'auto-request-review', + team_reviewers: [ + 'toads', + ], + }); + expect(isRejected).to.be.true; + expect(isResolved).to.be.false; + + expect(stub.secondCall.args[0]).to.deep.equal({ + owner: 'necojackarc', + pull_number: 18, + repo: 'auto-request-review', team_reviewers: [ 'koopa-troop', ], }); + + expect(stub.thirdCall.args[0]).to.deep.equal({ + owner: 'necojackarc', + pull_number: 18, + repo: 'auto-request-review', + reviewers: [ + 'mario', + ], + }); }); }); });