import { describe, test, expect, vi } from "vitest"; import UseCasesPage from "../../app/(marketing)/use-cases/page"; const { redirect } = vi.hoisted(() => ({ redirect: vi.fn((url) => { throw new Error(`NEXT_REDIRECT:${url}`); }), })); vi.mock("next/navigation", () => ({ redirect, })); describe("UseCasesPage", () => { test("sends the use cases index to Learn", () => { expect(() => UseCasesPage()).toThrow("NEXT_REDIRECT:/learn"); expect(redirect).toHaveBeenCalledWith("/learn"); }); });