feat(cv): harden multi-page builder
CI and Deploy / test (pull_request) Failing after 3m0s
CI and Deploy / deploy (pull_request) Has been skipped

Wrap pathological content, paginate oversized entries, measure A4 and Letter previews correctly, unify section ordering, and gate stored-output actions on saved state.
This commit is contained in:
cesnimda
2026-08-15 14:09:51 +02:00
parent d424633f95
commit 5203ddea72
19 changed files with 508 additions and 206 deletions
+15 -1
View File
@@ -1,4 +1,4 @@
import { moveItem, wrapSelection } from "./cvBuilder";
import { getCvPageCount, getCvPageMetrics, moveItem, wrapSelection } from "./cvBuilder";
describe("moveItem", () => {
test("moves an item forward", () => {
@@ -37,3 +37,17 @@ describe("wrapSelection", () => {
expect(r.text.slice(r.selStart, r.selEnd)).toBe("docs");
});
});
describe("CV page measurement", () => {
test("uses the selected physical page size", () => {
expect(getCvPageMetrics("a4")).toMatchObject({ widthMm: 210, heightMm: 297 });
expect(getCvPageMetrics("letter")).toMatchObject({ widthMm: 215.9, heightMm: 279.4 });
});
test("rounds layout pixels without hiding partial pages", () => {
const { heightPx } = getCvPageMetrics("a4");
expect(getCvPageCount(Math.ceil(heightPx), heightPx)).toBe(1);
expect(getCvPageCount(heightPx + 20, heightPx)).toBe(2);
expect(getCvPageCount(heightPx * 2 + 20, heightPx)).toBe(3);
});
});