Skip to content

Commit

Permalink
Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
oktapodia committed Aug 14, 2020
1 parent afe6fec commit 4741704
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/Issue.js
Original file line number Diff line number Diff line change
Expand Up @@ -248,15 +248,15 @@ class Issue extends Requestable {
}

/**
* Add a label to an issue
* Set labels to an issue
* @see https://developer.github.com/v3/issues/labels/#add-labels-to-an-issue
* @param {number} issue - the id of the issue to comment on
* @param {array} label - the names of the label to add to the issue
* @param {array} labels - the names of the labels to add to the issue
* @param {Requestable.callback} [cb] - will receive the status
* @return {Promise} - the promise for the http request
*/
addLabel(issue, label, cb) {
return this._request('POST', `/repos/${this.__repository}/issues/${issue}/labels`, label, cb);
setLabels(issue, labels, cb) {
return this._request('POST', `/repos/${this.__repository}/issues/${issue}/labels`, labels, cb);
}

/**
Expand Down
17 changes: 17 additions & 0 deletions test/issue.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,23 @@ describe('Issue', function() {

it('should delete issue comment', function(done) {
remoteIssues.deleteIssueComment(issueCommentId, assertSuccessful(done, function(err, response) {
expect(response.).to.be.true();

done();
}));
});

it('should set labels to an issue', function(done) {
const labelName = 'test label'
remoteIssues.setLabels(issueCommentId, [labelName], assertSuccessful(done, function(err, response) {
expect(response[0]).to.have.own('name', labelName);

done();
}));
});

it('should remove labels to an issue', function(done) {
remoteIssues.removeLabel(issueCommentId, 'test label', assertSuccessful(done, function(err, response) {
expect(response).to.be.true();

done();
Expand Down

0 comments on commit 4741704

Please sign in to comment.