import { describe, expect, it } from "vitest"; import { sheetToCsv } from "../../src/office/export"; import { parseOds } from "../../src/office/odf"; import { makeOdf, odsContent } from "./odf/fixtures"; describe("bounded OpenDocument exports", () => { it("exports cached sheet displays with repeats and CSV quoting", () => { const document = parseOds( makeOdf( "ods", odsContent(` A, B 42 `), ), ); expect(sheetToCsv(document.sheets[0]!)).toBe( '"A, B",42,42\r\n"A, B",42,42', ); }); it("refuses unbounded expanded CSV rows", () => { const document = parseOds( makeOdf( "ods", odsContent(` x `), ), ); expect(() => sheetToCsv(document.sheets[0]!)).toThrow(/50,000 rows/u); }); });