Track HiveGrid Cloud planning reference
This commit is contained in:
1 parent
b3d5ea6764
commit
e341c5938a
5784 files changed
+1104929
-3
No files matched your search
@@ -0,0 +1,39 @@
|
||||
import "@testing-library/jest-dom";
|
||||
import { render, screen } from "@testing-library/react";
|
||||
import React from "react";
|
||||
import { MemoryRouter } from "react-router";
|
||||
import { describe, expect, it, vi } from "vitest";
|
||||
import Page404 from "./Page404";
|
||||
|
||||
const translations = vi.hoisted<Record<string, string>>(() => ({
|
||||
"404.eyebrow": "404 error",
|
||||
}));
|
||||
|
||||
vi.mock("react-i18next", () => ({
|
||||
useTranslation: () => ({
|
||||
t: (key: string) => translations[key] ?? key,
|
||||
}),
|
||||
}));
|
||||
|
||||
vi.mock("~/components/brand/Logo", () => ({ default: () => <div data-testid="logo">Logo</div> }));
|
||||
vi.mock("~/components/public/PublicFooter", () => ({ default: () => <footer data-testid="public-footer">Footer</footer> }));
|
||||
|
||||
function renderPage404(props: React.ComponentProps<typeof Page404> = {}) {
|
||||
return render(
|
||||
<MemoryRouter>
|
||||
<Page404 {...props} />
|
||||
</MemoryRouter>
|
||||
);
|
||||
}
|
||||
|
||||
describe("Page404", () => {
|
||||
it("delegates to the shared 404 error page while preserving custom title and controls", () => {
|
||||
renderPage404({ title: "Missing project", withFooter: false, withGoBack: false });
|
||||
|
||||
expect(screen.getByTestId("error-page")).toHaveAttribute("data-error-status", "404");
|
||||
expect(screen.getByRole("heading", { name: "Missing project" })).toBeInTheDocument();
|
||||
expect(screen.getByText("404 error")).toBeInTheDocument();
|
||||
expect(screen.queryByTestId("public-footer")).not.toBeInTheDocument();
|
||||
expect(screen.queryByRole("button", { name: /go back/i })).not.toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user