Skip to content

Commit

Permalink
Merge pull request #559 from WJXHenry/issue-508
Browse files Browse the repository at this point in the history
Repository 'listCommits' working when options omitted
  • Loading branch information
j-rewerts authored May 27, 2019
2 parents 935783f + f2cfa93 commit 64c34b9
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/Repository.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
12 changes: 12 additions & 0 deletions test/repository.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 64c34b9

Please sign in to comment.