Skip to content

Commit 4741704

Browse files
committed
Add tests
1 parent afe6fec commit 4741704

File tree

2 files changed

+21
-4
lines changed

2 files changed

+21
-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: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,23 @@ describe('Issue', function() {
163163

164164
it('should delete issue comment', function(done) {
165165
remoteIssues.deleteIssueComment(issueCommentId, assertSuccessful(done, function(err, response) {
166+
expect(response.).to.be.true();
167+
168+
done();
169+
}));
170+
});
171+
172+
it('should set labels to an issue', function(done) {
173+
const labelName = 'test label'
174+
remoteIssues.setLabels(issueCommentId, [labelName], assertSuccessful(done, function(err, response) {
175+
expect(response[0]).to.have.own('name', labelName);
176+
177+
done();
178+
}));
179+
});
180+
181+
it('should remove labels to an issue', function(done) {
182+
remoteIssues.removeLabel(issueCommentId, 'test label', assertSuccessful(done, function(err, response) {
166183
expect(response).to.be.true();
167184

168185
done();

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy