Skip to content

Commit

Permalink
feature (repository): add listPullRequestReviews
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonBarendse committed Sep 3, 2017
1 parent 22b889c commit c73059a
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
11 changes: 11 additions & 0 deletions lib/Repository.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,17 @@ class Repository extends Requestable {
return this._request('GET', `/repos/${this.__fullname}/pulls/${number}/files`, null, cb);
}

/**
* List the reviews of a specific pull request
* @see https://developer.github.com/v3/pulls/reviews/
* @param {number|string} number - the PR you wish to fetch
* @param {Requestable.callback} [cb] - will receive the list of reviews from the API
* @return {Promise} - the promise for the http request
*/
listPullRequestReviews(number, cb) {
return this._request('GET', `/repos/${this.__fullname}/pulls/${number}/reviews`, null, cb);
}

/**
* Compare two branches/commits/repositories
* @see https://developer.github.com/v3/repos/commits/#compare-two-commits
Expand Down
9 changes: 9 additions & 0 deletions test/repository.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,15 @@ describe('Repository', function() {
done();
}));
});

it('should list pullrequest reviews', function(done) {
remoteRepo.listPullRequestReviews(454, assertSuccessful(done, function(err, reviews) {
expect(reviews).to.be.an.array();
expect(reviews[0]).to.have.own('body', 'Please add tests for this');

done();
}));
});
});

describe('creating/modifiying', function() {
Expand Down

0 comments on commit c73059a

Please sign in to comment.