import { readFileSync } from "node:fs"; import { fileURLToPath } from "node:url"; import { describe, expect, it } from "vitest"; const source = readFileSync(fileURLToPath(new URL("./sections.tsx", import.meta.url)), "utf8"); describe("ExperienceSection", () => { it("does not hide the item position header when role progression is present", () => { expect(source).not.toContain("item.roles.length === 0 && (hasPosition || hasSplitRowText(headerPeriod))"); }); it("does not repeat the summary period after rendering it in a role-progression header", () => { expect(source).not.toContain("item.roles.length > 0 && {item.period}"); }); }); describe("ItemTitle", () => { it("renders award titles without the bold style", () => { expect(source).toContain("const ItemTitle = ({ children, website, field, bold = true }: ItemTitleProps)"); expect(source).toContain("const title = bold ? (\n\t\t"); expect(source).toContain("\t) : (\n\t\t"); expect(source).toContain(''); }); }); describe("SectionShell", () => { it("keeps section and heading style rules when section heading icons are hidden", () => { expect(source).toContain( "const resolvedSectionStyle = composeStyles(sectionStyle, sectionRuleStyle, resolved.style)", ); expect(source).toContain(""); expect(source).toContain(""); }); it("wires the section heading container style slot into the icon row", () => { expect(source).toContain('useTemplateStyle("sectionHeadingContainer")'); expect(source).toContain("sectionHeadingContainerStyle"); }); it("top-aligns heading icon rows and does not use unsupported auto width resets", () => { const headingContainerBlock = source.match( /const defaultSectionHeadingContainerStyle = {(?[\s\S]*?)} satisfies Style;/, ); expect(headingContainerBlock?.groups?.body).toContain('alignItems: "flex-start"'); expect(source).toContain("getSectionHeadingTextStyle(sectionHeadingStyle, sectionHeadingRuleStyle)"); expect(source).toContain("width: _width"); expect(source).not.toContain('width: "auto"'); }); });