Files
Voiced/src/pdf/templates/harness.sweep.ts
T
xavierk a2152ae3c6 Add the Marble and Highlighter templates, completing the 13 Canva templates
Marble uses a flat-to-gradient band in place of the marble photo and bundles Lustria (OFL).
Both logo slots are opt-in. Quirk 13 documents a fontkit glyph-cache issue that the
tests work around with warm-up renders; the engine fix follows separately.
2026-10-04 12:47:05 +05:30

26 lines
1.4 KiB
TypeScript

import { describe, it } from "vitest";
import { makeItems, prefsFor, PAGE_SIZE_IDS, renderFixture, type FixtureSpec } from "./harness";
import { checkRendered } from "./harness.check";
import { TEMPLATES } from "./registry";
/** The standalone templates sweep in a file of their own, so vitest runs the two sweeps in parallel and the suite's wall time stays put. */
export const STANDALONE_SWEEP = ["monolith", "cobalt-stripe", "marble", "highlighter"];
/** 1..45 generated rows on A4 and Letter for the templates `pick` selects, each render through the harness checks. */
export function describeSweep(pick: (id: string) => boolean): void {
describe("template harness: item-count sweep", () => {
for (const template of Object.values(TEMPLATES).filter((t) => pick(t.id))) {
for (const size of PAGE_SIZE_IDS) {
it(`${template.id}: 1..45 items on ${size}`, async () => {
const prefs = prefsFor(size, { templateId: template.id });
for (let count = 1; count <= 45; count++) {
const spec: FixtureSpec = { name: `sweep-${count}`, items: makeItems(count, true), invoice: { notes: count % 3 === 0 ? "Payment due within 30 days.\nThank you." : "" }, signature: count % 2 === 0 };
const r = await renderFixture(spec, prefs);
checkRendered(r, `${template.id}/items=${count}/${size} (${r.result.pages} pages)`);
}
});
}
}
});
}