feat(housekeeping): deliver content vertical
This commit is contained in:
1 parent
bdab924bdf
commit
fd68819d9b
67 files changed
+5742
-1916
No files matched your search
@@ -0,0 +1,144 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { HOUSEKEEPING_MANIFESTS } from "../../manifests";
|
||||
import { contentMigrationEntries } from "../../migration/content";
|
||||
import { HOUSEKEEPING_ROUTE_HANDLERS } from "../../route-handlers";
|
||||
import { contentManifest } from "./manifest";
|
||||
import {
|
||||
CONTENT_ROUTE_GROUPS,
|
||||
CONTENT_ROUTE_IDS,
|
||||
CONTENT_ROUTES,
|
||||
type ContentRouteId,
|
||||
contentRouteGroup,
|
||||
} from "./routes";
|
||||
|
||||
const expected = [
|
||||
["content.editorial.articles", "/ase/content/editorial/articles", "editorial"],
|
||||
[
|
||||
"content.editorial.article-create",
|
||||
"/ase/content/editorial/articles/new",
|
||||
"editorial",
|
||||
],
|
||||
[
|
||||
"content.editorial.article-detail",
|
||||
"/ase/content/editorial/articles/:id",
|
||||
"editorial",
|
||||
],
|
||||
["content.media.photos", "/ase/content/media/photos", "media"],
|
||||
["content.media.library", "/ase/content/media/library", "media"],
|
||||
["content.media.banners", "/ase/content/media/banners", "media"],
|
||||
["content.media.ads", "/ase/content/media/ads", "media"],
|
||||
["content.media.ad-create", "/ase/content/media/ads/new", "media"],
|
||||
["content.media.ad-detail", "/ase/content/media/ads/:id", "media"],
|
||||
["content.engagement.events", "/ase/content/engagement/events", "engagement"],
|
||||
[
|
||||
"content.engagement.event-create",
|
||||
"/ase/content/engagement/events/create",
|
||||
"engagement",
|
||||
],
|
||||
[
|
||||
"content.engagement.event-types",
|
||||
"/ase/content/engagement/events/types",
|
||||
"engagement",
|
||||
],
|
||||
[
|
||||
"content.engagement.event-detail",
|
||||
"/ase/content/engagement/events/:id",
|
||||
"engagement",
|
||||
],
|
||||
["content.engagement.polls", "/ase/content/engagement/polls", "engagement"],
|
||||
[
|
||||
"content.engagement.poll-create",
|
||||
"/ase/content/engagement/polls/create",
|
||||
"engagement",
|
||||
],
|
||||
[
|
||||
"content.engagement.poll-detail",
|
||||
"/ase/content/engagement/polls/:id",
|
||||
"engagement",
|
||||
],
|
||||
["content.help.questions", "/ase/content/help/questions", "help"],
|
||||
[
|
||||
"content.help.question-create",
|
||||
"/ase/content/help/questions/new",
|
||||
"help",
|
||||
],
|
||||
[
|
||||
"content.help.question-detail",
|
||||
"/ase/content/help/questions/:id",
|
||||
"help",
|
||||
],
|
||||
["content.editorial.tags", "/ase/content/editorial/tags", "editorial"],
|
||||
[
|
||||
"content.engagement.prefixes",
|
||||
"/ase/content/engagement/prefixes",
|
||||
"engagement",
|
||||
],
|
||||
[
|
||||
"content.editorial.writeable-boxes",
|
||||
"/ase/content/editorial/writeable-boxes",
|
||||
"editorial",
|
||||
],
|
||||
[
|
||||
"content.help.email-templates",
|
||||
"/ase/content/help/email-templates",
|
||||
"help",
|
||||
],
|
||||
["content.brand.theme", "/ase/content/brand/theme", "brand"],
|
||||
["content.brand.favicon", "/ase/content/brand/favicon", "brand"],
|
||||
["content.localization.overview", "/ase/content/localization", "localization"],
|
||||
[
|
||||
"content.localization.client",
|
||||
"/ase/content/localization/client",
|
||||
"localization",
|
||||
],
|
||||
["content.localization.cms", "/ase/content/localization/cms", "localization"],
|
||||
[
|
||||
"content.localization.emulator",
|
||||
"/ase/content/localization/emulator",
|
||||
"localization",
|
||||
],
|
||||
] as const;
|
||||
|
||||
describe("Content routes", () => {
|
||||
it("declares the six exact route groups", () => {
|
||||
expect(CONTENT_ROUTE_GROUPS).toEqual([
|
||||
"editorial",
|
||||
"media",
|
||||
"engagement",
|
||||
"help",
|
||||
"brand",
|
||||
"localization",
|
||||
]);
|
||||
});
|
||||
|
||||
it("maps every migration row to its canonical route and group", () => {
|
||||
expect(
|
||||
CONTENT_ROUTES.map((route) => [
|
||||
route.id,
|
||||
route.href,
|
||||
contentRouteGroup(route.id as ContentRouteId),
|
||||
]),
|
||||
).toEqual(expected);
|
||||
expect(CONTENT_ROUTE_IDS).toEqual(expected.map(([id]) => id));
|
||||
expect(CONTENT_ROUTES.map((route) => route.href).sort()).toEqual(
|
||||
contentMigrationEntries
|
||||
.filter((entry) => entry.targetPath !== null)
|
||||
.map((entry) => entry.targetPath)
|
||||
.sort(),
|
||||
);
|
||||
});
|
||||
|
||||
it("keeps manifest routes and real handlers in exact equality", () => {
|
||||
expect(contentManifest.routes).toBe(CONTENT_ROUTES);
|
||||
expect(contentManifest.routes.map((route) => route.id)).toEqual(
|
||||
HOUSEKEEPING_ROUTE_HANDLERS.filter((handler) =>
|
||||
handler.routeId.startsWith("content."),
|
||||
).map((handler) => handler.routeId),
|
||||
);
|
||||
expect(
|
||||
HOUSEKEEPING_MANIFESTS.flatMap((manifest) =>
|
||||
manifest.routes.map((route) => route.id),
|
||||
),
|
||||
).toEqual(HOUSEKEEPING_ROUTE_HANDLERS.map((handler) => handler.routeId));
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user