Skip to content
This repository was archived by the owner on Dec 15, 2022. It is now read-only.

Commit b28a699

Browse files
committed
Default getAheadCount() and getBehindCount() to 0 instead of null
1 parent 2afab22 commit b28a699

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

lib/models/repository-states/state.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -364,11 +364,11 @@ export default class State {
364364
}
365365

366366
getAheadCount(branchName) {
367-
return Promise.resolve(null);
367+
return Promise.resolve(0);
368368
}
369369

370370
getBehindCount(branchName) {
371-
return Promise.resolve(null);
371+
return Promise.resolve(0);
372372
}
373373

374374
getConfig(optionName, options) {

test/models/repository.test.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,12 +73,15 @@ describe('Repository', function() {
7373
}
7474

7575
// Methods that resolve to null
76-
for (const method of [
77-
'getAheadCount', 'getBehindCount', 'getLastHistorySnapshots', 'getCache',
78-
]) {
76+
for (const method of ['getLastHistorySnapshots', 'getCache']) {
7977
assert.isNull(await repository[method]());
8078
}
8179

80+
// Methods that resolve to 0
81+
for (const method of ['getAheadCount', 'getBehindCount']) {
82+
assert.strictEqual(await repository[method](), 0);
83+
}
84+
8285
// Methods that resolve to an empty array
8386
for (const method of [
8487
'getRecentCommits', 'getAuthors', 'getDiscardHistory',

0 commit comments

Comments
 (0)