diff --git a/lib/Issue.js b/lib/Issue.js index bce20790..8a76686f 100644 --- a/lib/Issue.js +++ b/lib/Issue.js @@ -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); } /** diff --git a/test/issue.spec.js b/test/issue.spec.js index 274ca793..cbeac4d4 100644 --- a/test/issue.spec.js +++ b/test/issue.spec.js @@ -169,6 +169,24 @@ describe('Issue', function() { })); }); + it('should set labels to an issue', function(done) { + remoteIssues.setLabels(issueCommentId, ['test label'], assertSuccessful(done, function(err, response) { + console.log('aaaa', response) + expect(response).to.be.true(); + + done(); + })); + }); + + it('should remove labels to an issue', function(done) { + remoteIssues.setLabels(issueCommentId, 'test label', assertSuccessful(done, function(err, response) { + console.log('bbbbbb', response) + expect(response).to.be.true(); + + done(); + })); + }); + it('should create a milestone', function(done) { let milestone = { title: 'v42',