-
-
Notifications
You must be signed in to change notification settings - Fork 320
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Testing
git.diffSummary
from empty tree to first commit
Relates to #1035
- Loading branch information
Showing
1 changed file
with
30 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { like, newSimpleGit } from '@simple-git/test-utils'; | ||
|
||
describe('diffSummary', () => { | ||
it('empty tree to first commit', async () => { | ||
const git = newSimpleGit(); | ||
const emptyCommit = '4b825dc642cb6eb9a060e54bf8d69288fbee4904'; | ||
const firstCommit = await git.firstCommit(); | ||
|
||
const task = git.diffSummary([emptyCommit, firstCommit]); | ||
const result = await task; | ||
|
||
expect(result.changed).toBeGreaterThan(0); | ||
expect(result.changed).toBe(result.files.length); | ||
expect(result.insertions).toBeGreaterThan(0); | ||
expect(result.deletions).toBe(0); | ||
result.files.forEach((file) => { | ||
if (file.binary) { | ||
throw new Error(`Test assumes no binary files in first commit`); | ||
} | ||
|
||
expect(file.insertions).toBe(file.changes); | ||
expect(file).toEqual( | ||
like({ | ||
changes: file.insertions, | ||
deletions: 0, | ||
}) | ||
); | ||
}); | ||
}); | ||
}); |