Files
Reactive-Resume/packages/pdf/src/rtl-fixture.test.ts
T
Amruth Pillai f3a60432df refactor(pdf): introduce createBaseTemplateStyles factory (~1,150 lines removed)
Move 14 identical style slots (text/heading/div/inline/link/small/bold/
richParagraph/richListItemRow/richListItemMarker/richListItemContent/
splitRow/alignEnd/picture) from all 15 template Page.tsx files into a
single createBaseTemplateStyles factory in templates/shared. Each template
now spreads …base and keeps only its real overrides. Resolved StyleSheet
values are identical to before. Update rtl-fixture and rich-text-template-
styles tests to guard the factory file rather than each template directly.

Claude-Session: https://claude.ai/code/session_012Bnvt1MghwHj4qQRxuQUGa
2026-07-04 20:13:42 +02:00

29 lines
1.1 KiB
TypeScript

import { readFileSync } from "node:fs";
import { fileURLToPath } from "node:url";
import { describe, expect, it } from "vitest";
import { templateSchema } from "@reactive-resume/schema/templates";
const templatePages = templateSchema.options.map(
(template) =>
[
template,
fileURLToPath(new URL(`./templates/${template}/${capitalize(template)}Page.tsx`, import.meta.url)),
] as const,
);
function capitalize(template: string): string {
return template.charAt(0).toUpperCase() + template.slice(1);
}
describe("RTL PDF fixture", () => {
it.each(templatePages)("%s wires shared RTL helpers and alignEnd slot", (_template, pagePath) => {
const source = readFileSync(pagePath, "utf8");
expect(source).toContain("createRtlStyleHelpers");
// ponytail: alignEnd moved to createBaseTemplateStyles factory; either direct or factory counts.
expect(source.includes("alignEnd") || source.includes("createBaseTemplateStyles")).toBe(true);
expect(source).not.toContain("alignRight");
expect(source).not.toContain('from "@reactive-resume/utils/locale"');
});
});