Commit 4635b0fb authored by Phil Hughes's avatar Phil Hughes

updated diff spec

parent 6ff2fc84
...@@ -10,71 +10,71 @@ describe('Multi-file editor library diff calculator', () => { ...@@ -10,71 +10,71 @@ describe('Multi-file editor library diff calculator', () => {
describe('modified', () => { describe('modified', () => {
it('', () => { it('', () => {
const diff = computeDiff('123', '1234'); const diff = computeDiff('123', '1234')[0];
expect(diff[0].added).toBeTruthy(); expect(diff.added).toBeTruthy();
expect(diff[0].modified).toBeTruthy(); expect(diff.modified).toBeTruthy();
expect(diff[0].removed).toBeUndefined(); expect(diff.removed).toBeUndefined();
}); });
it('', () => { it('', () => {
const diff = computeDiff('123\n123\n123', '123\n1234\n123'); const diff = computeDiff('123\n123\n123', '123\n1234\n123')[0];
expect(diff[0].added).toBeTruthy(); expect(diff.added).toBeTruthy();
expect(diff[0].modified).toBeTruthy(); expect(diff.modified).toBeTruthy();
expect(diff[0].removed).toBeUndefined(); expect(diff.removed).toBeUndefined();
expect(diff[0].lineNumber).toBe(2); expect(diff.lineNumber).toBe(2);
}); });
}); });
describe('added', () => { describe('added', () => {
it('', () => { it('', () => {
const diff = computeDiff('123', '123\n123'); const diff = computeDiff('123', '123\n123')[0];
expect(diff[0].added).toBeTruthy(); expect(diff.added).toBeTruthy();
expect(diff[0].modified).toBeUndefined(); expect(diff.modified).toBeUndefined();
expect(diff[0].removed).toBeUndefined(); expect(diff.removed).toBeUndefined();
}); });
it('', () => { it('', () => {
const diff = computeDiff('123\n123\n123', '123\n123\n1234\n123'); const diff = computeDiff('123\n123\n123', '123\n123\n1234\n123')[0];
expect(diff[0].added).toBeTruthy(); expect(diff.added).toBeTruthy();
expect(diff[0].modified).toBeUndefined(); expect(diff.modified).toBeUndefined();
expect(diff[0].removed).toBeUndefined(); expect(diff.removed).toBeUndefined();
expect(diff[0].lineNumber).toBe(3); expect(diff.lineNumber).toBe(3);
}); });
}); });
describe('removed', () => { describe('removed', () => {
it('', () => { it('', () => {
const diff = computeDiff('123', ''); const diff = computeDiff('123', '')[0];
expect(diff[0].added).toBeUndefined(); expect(diff.added).toBeUndefined();
expect(diff[0].modified).toBeUndefined(); expect(diff.modified).toBeUndefined();
expect(diff[0].removed).toBeTruthy(); expect(diff.removed).toBeTruthy();
}); });
it('', () => { it('', () => {
const diff = computeDiff('123\n123\n123', '123\n123'); const diff = computeDiff('123\n123\n123', '123\n123')[0];
expect(diff[0].added).toBeUndefined(); expect(diff.added).toBeUndefined();
expect(diff[0].modified).toBeTruthy(); expect(diff.modified).toBeTruthy();
expect(diff[0].removed).toBeTruthy(); expect(diff.removed).toBeTruthy();
expect(diff[0].lineNumber).toBe(2); expect(diff.lineNumber).toBe(2);
}); });
}); });
it('includes line number of change', () => { it('includes line number of change', () => {
const diff = computeDiff('123', ''); const diff = computeDiff('123', '')[0];
expect(diff[0].lineNumber).toBe(1); expect(diff.lineNumber).toBe(1);
}); });
it('includes end line number of change', () => { it('includes end line number of change', () => {
const diff = computeDiff('123', ''); const diff = computeDiff('123', '')[0];
expect(diff[0].endLineNumber).toBe(1); expect(diff.endLineNumber).toBe(1);
}); });
}); });
}); });
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment