Skip to content

Commit

Permalink
Merge pull request #186 from lo1tuma/fix-octokit-usage
Browse files Browse the repository at this point in the history
Fix octokit usage
  • Loading branch information
lo1tuma authored Jan 8, 2019
2 parents 6dc6a3d + 177d0a8 commit 616fc8c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/getPullRequestLabel.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ async function getPullRequestLabel(githubRepo, validLabels, pullRequestId, { git

const [ owner, repo ] = githubRepo.split('/');
const params = { owner, repo, number: pullRequestId };
const { data: labels } = await githubClient.issues.getIssueLabels(params);
const { data: labels } = await githubClient.issues.listLabelsOnIssue(params);

const listOfLabels = validLabelNames.join(', ');
const filteredLabels = labels.filter((label) => {
Expand Down
6 changes: 3 additions & 3 deletions test/unit/lib/getPullRequestLabelSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import defaultValidLabels from '../../../lib/validLabels';
function createGithubClient(labels = []) {
return {
issues: {
getIssueLabels: sinon.stub().resolves({ data: labels })
listLabelsOnIssue: sinon.stub().resolves({ data: labels })
}
};
}
Expand All @@ -19,8 +19,8 @@ test('requests the labels for the correct repo and pull request', async (t) => {

await getPullRequestLabel(anyRepo, defaultValidLabels, anyPullRequestId, { githubClient });

t.is(githubClient.issues.getIssueLabels.callCount, 1);
t.deepEqual(githubClient.issues.getIssueLabels.firstCall.args, [
t.is(githubClient.issues.listLabelsOnIssue.callCount, 1);
t.deepEqual(githubClient.issues.listLabelsOnIssue.firstCall.args, [
{ owner: 'any', repo: 'repo', number: 123 }
]);
});
Expand Down

0 comments on commit 616fc8c

Please sign in to comment.