import { describe, expect, it } from 'vitest'; import { xmlElementStartLines } from '../../server/gpo/xml-source-lines'; describe('XML source-line provenance', () => { it('tracks mixed line endings while ignoring commented-out items', () => { const text = '\r\n\n\r\n'; expect(xmlElementStartLines(text, /])/g)).toEqual([2, 6]); }); it('scans the maximum supported Preference item count without prefix copies', () => { const count = 20_000; const text = `\n${Array.from({ length: count }, (_, index) => ``).join('\n')}\n`; const lines = xmlElementStartLines(text, /])/g); expect(lines).toHaveLength(count); expect(lines[0]).toBe(2); expect(lines.at(-1)).toBe(count + 1); }); });