Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 4bc6a06

Browse files
committed
Add tests
1 parent afe6fec commit 4bc6a06

File tree

2 files changed

+22
-4
lines changed

2 files changed

+22
-4
lines changed

lib/Issue.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -248,15 +248,15 @@ class Issue extends Requestable {
248248
}
249249

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

262262
/**

test/issue.spec.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,24 @@ describe('Issue', function() {
169169
}));
170170
});
171171

172+
it('should set labels to an issue', function(done) {
173+
remoteIssues.setLabels(issueCommentId, ['test label'], assertSuccessful(done, function(err, response) {
174+
console.log('aaaa', response)
175+
expect(response).to.be.true();
176+
177+
done();
178+
}));
179+
});
180+
181+
it('should remove labels to an issue', function(done) {
182+
remoteIssues.setLabels(issueCommentId, 'test label', assertSuccessful(done, function(err, response) {
183+
console.log('bbbbbb', response)
184+
expect(response).to.be.true();
185+
186+
done();
187+
}));
188+
});
189+
172190
it('should create a milestone', function(done) {
173191
let milestone = {
174192
title: 'v42',

0 commit comments

Comments
 (0)