Added getAheadBehindCount.

This commit is contained in:
joshaber
2015-12-02 17:20:38 -05:00
parent aa634570e6
commit cb62d917de
2 changed files with 73 additions and 23 deletions

View File

@@ -409,4 +409,31 @@ describe('GitRepositoryAsync', () => {
expect(head).toBe('master')
})
})
describe('.getAheadBehindCount(reference, path)', () => {
beforeEach(() => {
const workingDirectory = copyRepository()
repo = GitRepositoryAsync.open(workingDirectory)
})
it('returns 0, 0 for a branch with no upstream', async () => {
const {ahead, behind} = await repo.getAheadBehindCount('master')
expect(ahead).toBe(0)
expect(behind).toBe(0)
})
})
describe('.getCachedUpstreamAheadBehindCount(path)', () => {
beforeEach(() => {
const workingDirectory = copyRepository()
repo = GitRepositoryAsync.open(workingDirectory)
})
it('returns 0, 0 for a branch with no upstream', async () => {
await repo.refreshStatus()
const {ahead, behind} = repo.getCachedUpstreamAheadBehindCount()
expect(ahead).toBe(0)
expect(behind).toBe(0)
})
})
})