import { QueryClient, QueryClientProvider } from "@tanstack/react-query"; import { renderToString } from "react-dom/server"; import { MemoryRouter } from "react-router-dom"; import { describe, expect, it } from "vitest"; import { getGetCurrentSessionQueryKey } from "../../../shared/api/endpoints/identity/identity"; import type { Session } from "../../../shared/api/schemas"; import { CandidateNotificationsPage, EmployerNotificationsPage } from "./notifications-pages"; function render(scenario: "candidate" | "employer", element: React.ReactElement): string { const queryClient = new QueryClient(); const session: Session = { account: { id: "11111111-1111-4111-8111-111111111111", email: "person@example.test", email_verified: true, scenario, onboarding_step: "completed", created_at: "2026-10-07T12:00:00Z", }, csrf_token: "A".repeat(43), }; queryClient.setQueryData(getGetCurrentSessionQueryKey(), session); return renderToString( {element} , ); } describe("notification pages", () => { it("name the cabinet and carry the single h1", () => { const candidate = render("candidate", ); expect(candidate).toContain("Кабинет кандидата"); expect(candidate.match(/

); expect(employer).toContain("Кабинет работодателя"); expect(employer.match(/

{ expect(render("employer", )).toContain("кабинету другого типа"); expect(render("candidate", )).toContain("кабинета работодателя"); }); });