41 lines
1.5 KiB
TypeScript
41 lines
1.5 KiB
TypeScript
// @vitest-environment jsdom
|
|
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_P20_INTERIM_VISUAL_SCREENS, AkP20InterimVisualFixture } from "./ak-p20-interim.visual-fixture";
|
|
|
|
vi.mock("react-i18next", () => ({
|
|
useTranslation: () => ({
|
|
t: (key: string, values?: Record<string, unknown>) => (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,
|
|
}),
|
|
}));
|
|
|
|
describe("AK-P20 interim visual baseline", () => {
|
|
it("renders representative ready states for all five real ~/ui screens", () => {
|
|
const { container } = render(
|
|
<main data-ui-id="ui.akP20.interim.visualBaseline">
|
|
{AK_P20_INTERIM_VISUAL_SCREENS.map((screen) => (
|
|
<AkP20InterimVisualFixture key={screen} screen={screen} />
|
|
))}
|
|
</main>
|
|
);
|
|
|
|
expect(container.querySelectorAll("[data-ui-id$='.page']")).toHaveLength(5);
|
|
const stableMarkup = container.innerHTML.replace(/<svg\b[^>]*>[\s\S]*?<\/svg>/gu, '<svg data-visual-icon="true"></svg>');
|
|
expect(stableMarkup).toMatchSnapshot();
|
|
});
|
|
});
|