diff --git a/lib/Repository.js b/lib/Repository.js index 5c8eb7ff..8cf23dc2 100644 --- a/lib/Repository.js +++ b/lib/Repository.js @@ -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 = {}; diff --git a/test/repository.spec.js b/test/repository.spec.js index a8a05a7c..dceeffac 100644 --- a/test/repository.spec.js +++ b/test/repository.spec.js @@ -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);