islandflow/apps/web/app/routes.test.ts
dirtydishes 4ae32c4f3b
Some checks failed
CI / Validate (push) Failing after 1m7s
stabilize forgejo ci bun path and mocks
2026-05-30 01:44:45 -04:00

38 lines
1.2 KiB
TypeScript

import { beforeEach, describe, expect, it, mock } from "bun:test";
const redirect = mock((path: string) => {
throw new Error(`NEXT_REDIRECT:${path}`);
});
mock.module("next/navigation", () => ({ default: { redirect }, redirect }));
mock.module("next/navigation.js", () => ({ default: { redirect }, redirect }));
describe("legacy page redirects", () => {
beforeEach(() => {
redirect.mockClear();
});
it("redirects /signals to home", async () => {
const mod = await import("./signals/page");
expect(() => mod.default()).toThrow("NEXT_REDIRECT:/");
expect(redirect).toHaveBeenCalledWith("/");
});
it("redirects /charts to home", async () => {
const mod = await import("./charts/page");
expect(() => mod.default()).toThrow("NEXT_REDIRECT:/");
expect(redirect).toHaveBeenCalledWith("/");
});
it("redirects /replay to home", async () => {
const mod = await import("./replay/page");
expect(() => mod.default()).toThrow("NEXT_REDIRECT:/");
expect(redirect).toHaveBeenCalledWith("/");
});
it("redirects /tape to /options", async () => {
const mod = await import("./tape/page");
expect(() => mod.default()).toThrow("NEXT_REDIRECT:/options");
expect(redirect).toHaveBeenCalledWith("/options");
});
});