34 lines
1.5 KiB
JavaScript
34 lines
1.5 KiB
JavaScript
import { describe, expect, it } from "vitest";
|
|
|
|
import { ROUTE_INVENTORY_BUDGETS, classifyRouteModule, classifyRouteSurface, evaluateRouteInventory } from "./verify-route-inventory.mjs";
|
|
|
|
describe("verify-route-inventory", () => {
|
|
it("classifies route files by surface and module profile", () => {
|
|
expect(classifyRouteSurface("admin/settings.tsx")).toBe("admin");
|
|
expect(classifyRouteSurface("app.$tenant/settings.tsx")).toBe("tenant");
|
|
expect(classifyRouteSurface("docs/($lang).tsx")).toBe("public_help_docs_internal");
|
|
expect(classifyRouteSurface("admin/email-marketing/index.tsx")).toBe("optional");
|
|
|
|
expect(classifyRouteModule("admin/settings.tsx")).toBe("default-enabled");
|
|
expect(classifyRouteModule("docs/($lang).tsx")).toBe("core");
|
|
expect(classifyRouteModule("app.$tenant/__workflows/workflow-engine.tsx")).toBe("optional");
|
|
});
|
|
|
|
it("keeps route surface budgets explicit and hard", () => {
|
|
expect(ROUTE_INVENTORY_BUDGETS).toEqual({
|
|
admin: 167,
|
|
tenant: 78,
|
|
public_help_docs_internal: 58,
|
|
optional: 208,
|
|
total: 474,
|
|
});
|
|
|
|
const results = evaluateRouteInventory({
|
|
surfaces: { admin: ROUTE_INVENTORY_BUDGETS.admin + 1, tenant: 1, public_help_docs_internal: 1, optional: 1, total: ROUTE_INVENTORY_BUDGETS.total + 1 },
|
|
classifications: { core: 1, "default-enabled": ROUTE_INVENTORY_BUDGETS.admin + 2, optional: 1 },
|
|
files: [],
|
|
});
|
|
expect(results.find((result) => result.surface === "admin")?.pass).toBe(false);
|
|
});
|
|
});
|