Skip to content

Commit

Permalink
Re-added test and default value setting for options
Browse files Browse the repository at this point in the history
  • Loading branch information
WJXHenry committed May 4, 2019
1 parent 9f558aa commit f2cfa93
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/Repository.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ class Repository extends Requestable {
* @return {Promise} - the promise for the http request
*/
listCommits(options, cb) {
options = options || {};
if (typeof options === 'function') {
cb = options;
options = {};
Expand Down
12 changes: 12 additions & 0 deletions test/repository.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,18 @@ describe('Repository', function() {
}));
});

it('should list commits with null options', function(done) {
remoteRepo.listCommits(null, assertSuccessful(done, function(err, commits) {
expect(commits).to.be.an.array();
expect(commits.length).to.be.above(0);

expect(commits[0]).to.have.own('commit');
expect(commits[0]).to.have.own('author');

done();
}));
});

it('should list commits with all options', function(done) {
const since = new Date(2015, 0, 1);
const until = new Date(2016, 0, 20);
Expand Down

0 comments on commit f2cfa93

Please sign in to comment.