Files
HiveGrid-Wireframes/03 Quellen und Referenzen/hivegrid-cloud/apps/web/app/components/screens/telephony/telephony-interim.visual.test.tsx
T

43 lines
1.7 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 { TELEPHONY_INTERIM_VISUAL_SCREENS, TelephonyInterimVisualFixture } from "./telephony-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),
date: (value: string) => value,
dateTime: (value: string) => `date:${value}`,
}),
}));
describe("AK-P15a telephony interim visual baseline", () => {
it("renders the settings, call list, detail, and click-to-call surfaces from ~/ui", () => {
render(
<main data-ui-id="ui.telephony.interim.visualBaseline">
{TELEPHONY_INTERIM_VISUAL_SCREENS.map((screen) => (
<TelephonyInterimVisualFixture key={screen} screen={screen} />
))}
</main>,
);
expect(document.querySelectorAll("[data-ui-id='ui.telephony.settings.page']")).toHaveLength(1);
expect(document.querySelectorAll("[data-ui-id='ui.telephony.calls.page']")).toHaveLength(1);
expect(document.querySelectorAll("[data-ui-id='ui.telephony.callDetail.page']")).toHaveLength(1);
expect(document.querySelectorAll("[data-ui-id='ui.telephony.clickToCall.dialog']")).toHaveLength(1);
const stableMarkup = document.body.innerHTML.replace(/<svg\b[^>]*>[\s\S]*?<\/svg>/gu, '<svg data-visual-icon="true"></svg>');
expect(stableMarkup).toMatchSnapshot();
});
});