diff --git a/lib/Repository.js b/lib/Repository.js index e796e1bf..16733e67 100644 --- a/lib/Repository.js +++ b/lib/Repository.js @@ -188,7 +188,10 @@ class Repository extends Requestable { */ listCommits(options, cb) { options = options || {}; - + if (typeof options === 'function') { + cb = options; + options = {}; + } options.since = this._dateToISO(options.since); options.until = this._dateToISO(options.until); diff --git a/test/repository.spec.js b/test/repository.spec.js index 5498cb24..3f600456 100644 --- a/test/repository.spec.js +++ b/test/repository.spec.js @@ -125,6 +125,18 @@ describe('Repository', function() { }); it('should list commits with no options', function(done) { + remoteRepo.listCommits(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 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);