Added .getLineDiffs

This commit is contained in:
joshaber
2015-12-03 15:34:58 -05:00
parent 53be0cf965
commit 4fbbcac3bc
2 changed files with 64 additions and 13 deletions

View File

@@ -500,7 +500,6 @@ describe('GitRepositoryAsync', () => {
describe('.getConfigValue(key, path)', () => {
beforeEach(() => {
const workingDirectory = copyRepository()
console.log(workingDirectory)
repo = GitRepositoryAsync.open(workingDirectory)
})
@@ -518,7 +517,6 @@ describe('GitRepositoryAsync', () => {
describe('.checkoutReference(reference, create)', () => {
beforeEach(() => {
const workingDirectory = copyRepository()
console.log(workingDirectory)
repo = GitRepositoryAsync.open(workingDirectory)
})
@@ -534,4 +532,19 @@ describe('GitRepositoryAsync', () => {
})
})
})
describe('.getLineDiffs(path, text)', () => {
beforeEach(() => {
const workingDirectory = copyRepository()
repo = GitRepositoryAsync.open(workingDirectory)
})
it('can get the line diff', async () => {
const {oldStart, newStart, oldLines, newLines} = await repo.getLineDiffs('a.txt', 'hi there')
expect(oldStart).toBe(0)
expect(oldLines).toBe(0)
expect(newStart).toBe(1)
expect(newLines).toBe(1)
})
})
})