// @vitest-environment jsdom // AK-P21 — INTERIM visual baseline (AD-28). Re-baseline is mandatory when // David's final D-P21 Subframe optics replace the interim privacy screens. import "@testing-library/jest-dom/vitest"; import React from "react"; import { render } from "@testing-library/react"; import { describe, expect, it, vi } from "vitest"; import { AK_P21_INTERIM_VISUAL_SCREENS, AkP21InterimVisualFixture } from "./ak-p21-interim.visual-fixture"; vi.mock("react-i18next", () => ({ useTranslation: () => ({ t: (key: string, values?: Record) => (values ? `${key}:${Object.values(values).join("/")}` : key), i18n: { language: "de" }, }), })); vi.mock("~/locale/format", () => ({ useLocaleFormatters: () => ({ number: (value: number) => String(value), currency: (value: number, currency: string) => `${value.toFixed(2)} ${currency}`, currencyFromCents: (value: number, currency: string) => `${(value / 100).toFixed(2)} ${currency}`, date: (value: string) => value, dateTime: (value: string) => value, }), })); vi.mock("react-router", async () => { const actual = await vi.importActual("react-router"); return { ...actual, Form: ({ children, ...props }: React.ComponentProps<"form">) =>
{children}
, // The baseline renders the screens without a router provider; the // breadcrumb Link only needs to contribute its href to the snapshot. Link: ({ to, children, ...props }: { to: string } & React.ComponentProps<"a">) => ( {children} ), }; }); describe("AK-P21 interim visual baseline", () => { it("renders representative ready states for all five privacy ~/ui screens", () => { const { container } = render(
{AK_P21_INTERIM_VISUAL_SCREENS.map((screen) => ( ))}
); expect(container.querySelectorAll("[data-ui-id$='.page']")).toHaveLength(5); const stableMarkup = container.innerHTML.replace(/]*>[\s\S]*?<\/svg>/gu, ''); expect(stableMarkup).toMatchSnapshot(); }); });