feat: add housekeeping inventory foundation #51

Merged
Simo merged 30 commits from codex/housekeeping-foundation into main 2026-08-26 19:50:40 +02:00
2 changed files with 37 additions and 1 deletions
Showing only changes of commit a619f89106 - Show all commits

No files matched your search

@@ -42,6 +42,42 @@ describe("discoverLegacyPages", () => {
});
});
it("discovers root administration and moderation routes", () => {
expect(discoverLegacyPages()).toEqual(
expect.arrayContaining([
{
surface: "admin",
legacyPath: "/admin",
sourceFile: "src/app/admin/page.tsx",
},
{
surface: "mod",
legacyPath: "/mod",
sourceFile: "src/app/mod/page.tsx",
},
]),
);
});
it("discovers root routes in a controlled route tree", () => {
const root = createRouteTree([
"src/app/admin/page.tsx",
"src/app/mod/page.tsx",
]);
expect(discoverLegacyPages(root)).toEqual([
{
surface: "admin",
legacyPath: "/admin",
sourceFile: "src/app/admin/page.tsx",
},
{
surface: "mod",
legacyPath: "/mod",
sourceFile: "src/app/mod/page.tsx",
},
]);
});
it("sorts a controlled route tree by surface, route, then source file", () => {
const root = createRouteTree([
"src/app/mod/zebra/page.tsx",
@@ -38,7 +38,7 @@ function discoverSurface(
const sourceFile = relative(rootDir, entryPath).replaceAll("\\", "/");
const routeSegments = relative(surfaceDirectory, directory)
.split(/[/\\]/)
.filter(Boolean);
.filter((segment) => segment && segment !== ".");
pages.push({
surface,
legacyPath: toLegacyPath(surface, routeSegments),