Generate a large diff metadata fixture without checking a huge file into the repo.
(lineCount: number, widestLine: string)
| 5 | |
| 6 | /** Generate a large diff metadata fixture without checking a huge file into the repo. */ |
| 7 | function createLargeLineFixture(lineCount: number, widestLine: string): DiffFile { |
| 8 | const additionLines = Array.from({ length: lineCount }, (_, index) => |
| 9 | index === lineCount - 1 ? widestLine : "x", |
| 10 | ); |
| 11 | |
| 12 | return { |
| 13 | agent: null, |
| 14 | id: "large-untracked", |
| 15 | metadata: { |
| 16 | additionLines, |
| 17 | deletionLines: [], |
| 18 | hunks: [], |
| 19 | } as unknown as DiffFile["metadata"], |
| 20 | patch: "", |
| 21 | path: "large-untracked.txt", |
| 22 | stats: { additions: lineCount, deletions: 0 }, |
| 23 | }; |
| 24 | } |
| 25 | |
| 26 | describe("code column measurement", () => { |
| 27 | test("measures large generated fixtures without overflowing the call stack", () => { |