diff --git a/packages/web/src/app/not-found.test.tsx b/packages/web/src/app/not-found.test.tsx new file mode 100644 index 000000000..c370cae0a --- /dev/null +++ b/packages/web/src/app/not-found.test.tsx @@ -0,0 +1,33 @@ +import { render, screen } from "@testing-library/react"; +import { describe, it, expect, vi } from "vitest"; + +vi.mock("next/link", () => ({ + default: ({ + children, + ...props + }: React.PropsWithChildren>) => ( + {children} + ), +})); + +import NotFound from "./not-found"; + +describe("NotFound (global)", () => { + it("renders the page-not-found message", () => { + render(); + expect(screen.getByText("Page not found")).toBeInTheDocument(); + }); + + it("renders a link back to the dashboard", () => { + render(); + const link = screen.getByText("← Back to dashboard"); + expect(link).toBeInTheDocument(); + expect(link.closest("a")).toHaveAttribute("href", "/"); + }); + + it("renders the not-found icon", () => { + const { container } = render(); + const svg = container.querySelector("svg"); + expect(svg).toBeInTheDocument(); + }); +}); diff --git a/packages/web/src/app/not-found.tsx b/packages/web/src/app/not-found.tsx new file mode 100644 index 000000000..868beb5f0 --- /dev/null +++ b/packages/web/src/app/not-found.tsx @@ -0,0 +1,27 @@ +import Link from "next/link"; + +export default function NotFound() { + return ( +
+ + + + +

+ Page not found +

+ + ← Back to dashboard + +
+ ); +}