b5dac8886f
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
19 lines
717 B
TypeScript
19 lines
717 B
TypeScript
import { describe, expect, it } from "vitest";
|
|
import { adminViewFor, hashFor, type AdminView } from "./adminRouting";
|
|
|
|
const VIEWS: AdminView[] = [
|
|
{ view: "home" }, { view: "products" }, { view: "import-upload" },
|
|
{ view: "import-preview", draftId: 7 }, { view: "run-detail", runId: 12 },
|
|
];
|
|
|
|
describe("adminRouting", () => {
|
|
it("round-trips every view", () => {
|
|
for (const v of VIEWS) expect(adminViewFor(hashFor(v))).toEqual(v);
|
|
});
|
|
it("defaults junk to home/products", () => {
|
|
expect(adminViewFor("")).toEqual({ view: "home" });
|
|
expect(adminViewFor("#/nonsense")).toEqual({ view: "home" });
|
|
expect(adminViewFor("#/products/imports/drafts/abc")).toEqual({ view: "products" });
|
|
});
|
|
});
|