From f2cfa935ade542a3f552495635fb1f7f3f3b8ce1 Mon Sep 17 00:00:00 2001 From: WJXHenry Date: Sat, 4 May 2019 17:00:45 -0600 Subject: [PATCH] Re-added test and default value setting for options --- lib/Repository.js | 1 + test/repository.spec.js | 12 ++++++++++++ 2 files changed, 13 insertions(+) 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);