| 1 | import { describe, expect, it } from 'vitest'; |
| 2 | |
| 3 | import { parseHunks } |
| 4 | import { diffHunkFor } |
| 5 | |
| 6 | const hunks = parseHunks |
| 7 | ['@@ -1,4 +1,5 @@', ' a' |
| 8 | ); |
| 9 | |
| 10 | describe('diffHunkFor', () |
| 11 | it('leads into the commented line with the three rows before it and a header of its own', |
| 12 | expect(diffHunkFor(hunks |
| 13 | ['@@ -3,2 +3,3 @@', '-c' |
| 14 | ); |
| 15 | }); |
| 16 | |
| 17 | it('covers a whole range, and finds a line on the base side', |
| 18 | expect( |
| 19 | diffHunkFor(hunks, { |
| 20 | side: 'additions', |
| 21 | line: 4, |
| 22 | startSide: 'additions', |
| 23 | startLine: 3, |
| 24 | }), |
| 25 | ).toBe(['@@ -1,3 +1,4 @@' |
| 26 | expect(diffHunkFor(hunks |
| 27 | ['@@ -1,3 +1,2 @@', ' a' |
| 28 | ); |
| 29 | }); |
| 30 | |
| 31 | it('is null for a line the diff does not show', |
| 32 | expect(diffHunkFor(hunks |
| 33 | }); |
| 34 | }); |