30 lines
1.1 KiB
TypeScript
30 lines
1.1 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
import { CONTENT_ROUTE_IDS } from "./domains/content/routes";
|
|
import { ECONOMY_ROUTE_IDS } from "./domains/economy/routes";
|
|
import { PEOPLE_ROUTE_IDS } from "./domains/people/routes";
|
|
import { SYSTEM_ROUTE_IDS } from "./domains/system/routes";
|
|
import { createHousekeepingRegistry } from "./foundation/registry";
|
|
import { HOUSEKEEPING_MANIFESTS } from "./manifests";
|
|
import { HOUSEKEEPING_ROUTE_HANDLERS } from "./route-handlers";
|
|
|
|
describe("housekeeping route handlers", () => {
|
|
it("has exactly one handler for every registered route and no placeholders", () => {
|
|
const registry = createHousekeepingRegistry(HOUSEKEEPING_MANIFESTS);
|
|
const routeIds = registry.domains.flatMap((domain) =>
|
|
domain.routes.map((route) => route.id),
|
|
);
|
|
const handlerIds = HOUSEKEEPING_ROUTE_HANDLERS.map(
|
|
(handler) => handler.routeId,
|
|
);
|
|
|
|
expect(new Set(handlerIds).size).toBe(handlerIds.length);
|
|
expect([...handlerIds].sort()).toEqual([...routeIds].sort());
|
|
expect(handlerIds).toEqual([
|
|
...PEOPLE_ROUTE_IDS,
|
|
...CONTENT_ROUTE_IDS,
|
|
...ECONOMY_ROUTE_IDS,
|
|
...SYSTEM_ROUTE_IDS,
|
|
]);
|
|
});
|
|
});
|