Skip to content

Commit a37e56f

Browse files
committed
Add options to the listReleases and listTags function and fix markdown test
1 parent 24223f7 commit a37e56f

File tree

3 files changed

+21
-5
lines changed

3 files changed

+21
-5
lines changed

lib/Repository.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,12 @@ class Repository extends Requestable {
7878
/**
7979
* List the tags on a repository
8080
* @see https://developer.github.com/v3/repos/#list-tags
81+
* @param {Object} options - pagination for the list
8182
* @param {Requestable.callback} [cb] - will receive the tag data
8283
* @return {Promise} - the promise for the http request
8384
*/
84-
listTags(cb) {
85-
return this._request('GET', `/repos/${this.__fullname}/tags`, null, cb);
85+
listTags(options, cb = options) {
86+
return this._request('GET', `/repos/${this.__fullname}/tags`, options !== 'function' && options, cb);
8687
}
8788

8889
/**
@@ -793,11 +794,12 @@ class Repository extends Requestable {
793794
/**
794795
* Get information about all releases
795796
* @see https://developer.github.com/v3/repos/releases/#list-releases-for-a-repository
797+
* @param {Object} options - pagination for the list
796798
* @param {Requestable.callback} cb - will receive the release information
797799
* @return {Promise} - the promise for the http request
798800
*/
799-
listReleases(cb) {
800-
return this._request('GET', `/repos/${this.__fullname}/releases`, null, cb);
801+
listReleases(options, cb = options) {
802+
return this._request('GET', `/repos/${this.__fullname}/releases`, options !== 'function' && options, cb);
801803
}
802804

803805
/**

test/markdown.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ describe('Markdown', function() {
3737
};
3838
markdown.render(options)
3939
.then(function({data: html}) {
40-
expect(html).to.be('<p>Hello world <a href="https://github.com/github/linguist/issues/1" class="issue-link js-issue-link" data-url="https://github.com/github/linguist/issues/1" data-id="1012654" data-error-text="Failed to load issue title" data-permission-text="Issue title is private">github/linguist#1</a> <strong>cool</strong>, and <a href="https://github.com/gollum/gollum/issues/1" class="issue-link js-issue-link" data-url="https://github.com/gollum/gollum/issues/1" data-id="183433" data-error-text="Failed to load issue title" data-permission-text="Issue title is private">#1</a>!</p>'); // eslint-disable-line
40+
expect(html).to.be('<p>Hello world <a href="https://github.com/github/linguist/issues/1" class="issue-link js-issue-link" data-error-text="Failed to load issue title" data-id="1012654" data-permission-text="Issue title is private" data-url="https://github.com/github/linguist/issues/1">github/linguist#1</a> <strong>cool</strong>, and <a href="https://github.com/gollum/gollum/issues/1" class="issue-link js-issue-link" data-error-text="Failed to load issue title" data-id="183433" data-permission-text="Issue title is private" data-url="https://github.com/gollum/gollum/issues/1">#1</a>!</p>'); // eslint-disable-line
4141
done();
4242
}).catch(done);
4343
});

test/repository.spec.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -459,6 +459,11 @@ describe('Repository', function() {
459459
});
460460

461461
it('should list tags on repo', function(done) {
462+
const options = {
463+
per_page: 30 //eslint-disable-line
464+
};
465+
466+
remoteRepo.listTags(options, assertSuccessful(done));
462467
remoteRepo.listTags(assertSuccessful(done));
463468
});
464469

@@ -628,6 +633,15 @@ describe('Repository', function() {
628633
});
629634

630635
it('should read all releases', function(done) {
636+
const options = {
637+
per_page: 30 //eslint-disable-line
638+
};
639+
640+
remoteRepo.listReleases(options, assertSuccessful(done, function(err, releases) {
641+
expect(releases).to.be.an.array();
642+
done();
643+
}));
644+
631645
remoteRepo.listReleases(assertSuccessful(done, function(err, releases) {
632646
expect(releases).to.be.an.array();
633647
done();

0 commit comments

Comments
 (0)