Release Office Tools 0.2.0
Verify / verify (push) Canceled after 0s

This commit is contained in:
2026-09-02 07:32:31 +02:00
parent a5524e27e3
commit 08b8f84f7b
50 changed files with 2196 additions and 165 deletions
+37
View File
@@ -0,0 +1,37 @@
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(`<table:table table:name="Data">
<table:table-row table:number-rows-repeated="2">
<table:table-cell office:value-type="string"><text:p>A, B</text:p></table:table-cell>
<table:table-cell table:number-columns-repeated="2" office:value-type="float" office:value="42"><text:p>42</text:p></table:table-cell>
</table:table-row>
</table:table>`),
),
);
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(`<table:table table:name="Large">
<table:table-row table:number-rows-repeated="50001">
<table:table-cell office:value-type="string"><text:p>x</text:p></table:table-cell>
</table:table-row>
</table:table>`),
),
);
expect(() => sheetToCsv(document.sheets[0]!)).toThrow(/50,000 rows/u);
});
});