Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds method for listing review comments #404

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions lib/Repository.js
Original file line number Diff line number Diff line change
Expand Up @@ -803,6 +803,17 @@ class Repository extends Requestable {
mergePullRequest(number, options, cb) {
return this._request('PUT', `/repos/${this.__fullname}/pulls/${number}/merge`, options, cb);
}

/**
* List review comments on an pull request
* @see https://developer.github.com/v3/pulls/comments/#list-comments-on-a-pull-request
* @param {number|string} number - the number of the pull request to get review comments from
* @param {Requestable.callback} [cb] - will receive the comments
* @return {Promise} - the promise for the http request
*/
listPullRequestReviewComments(number, cb) {
return this._request('GET', `/repos/${this.__fullname}/pulls/${number}/comments`, null, cb);
}
}

module.exports = Repository;
10 changes: 10 additions & 0 deletions test/repository.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,16 @@ describe('Repository', function() {
done();
}));
});

it('should list review comments', function(done) {
const repo = github.getRepo('michael', 'github');
Copy link
Member

@mtscout6 mtscout6 Dec 2, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This project was moved to the github-tools Organization. You'll want to update this to get the tests working.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You'll also want to update based on the latest changes from master that got the tests working again.


repo.listPullRequestReviewComments(401, assertSuccessful(done, function(err, reviewComments) {
expect(reviewComments).to.be.an.array();
//expect(reviewComments[0]).to.have.own('body', 'Comment test'); //TODO: Need to establish a test PR with test review comments
done();
}));
});
});

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