create-ailk 0.39.0 → 0.40.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (187) hide show
  1. package/dist/add-route.js +15 -0
  2. package/dist/body-heading.d.ts +2 -1
  3. package/dist/body-heading.js +31 -3
  4. package/dist/module-architecture.js +0 -3
  5. package/dist/remove-module.js +13 -4
  6. package/dist/routes.d.ts +7 -0
  7. package/dist/routes.js +1 -1
  8. package/dist/site-roster.js +7 -1
  9. package/dist/surfaces.d.ts +2 -0
  10. package/dist/surfaces.js +59 -172
  11. package/package.json +3 -3
  12. package/templates/apps/web/CLAUDE.md +7 -1
  13. package/templates/apps/web/__tests__/__mocks__/next-intl-server.ts +3 -2
  14. package/templates/apps/web/__tests__/__mocks__/next-intl.ts +3 -2
  15. package/templates/apps/web/app/[locale]/layout.tsx +1 -1
  16. package/templates/apps/web/i18n/request.ts +5 -1
  17. package/templates/apps/web/jest.config.cjs +6 -0
  18. package/templates/apps/web/lib/__tests__/deck-page.test.ts +9 -0
  19. package/templates/apps/web/lib/__tests__/in-page-magnet-self-request.test.ts +1 -1
  20. package/templates/apps/web/lib/__tests__/in-page-magnet.test.ts +2 -2
  21. package/templates/apps/web/lib/__tests__/pricing-page.test.ts +1 -1
  22. package/templates/apps/web/lib/__tests__/structured-data.test.tsx +17 -4
  23. package/templates/apps/web/lib/in-page-magnet.ts +2 -2
  24. package/templates/apps/web/lib/pricing-page.ts +3 -3
  25. package/templates/apps/web/{app/[locale]/contact → lib}/site-contact-email.ts +1 -1
  26. package/templates/apps/web/{app/[locale]/contact → lib}/site-contact-lines.ts +1 -1
  27. package/templates/apps/web/lib/site-header.ts +1 -1
  28. package/templates/apps/web/messages/en.json +0 -119
  29. package/templates/apps/web/next.config.mjs +7 -0
  30. package/templates/apps/web/package.json +1 -0
  31. package/templates/apps/web/site-pages.config.tsx +85 -0
  32. package/templates/tools/body-heading.ts +30 -3
  33. package/versions.json +50 -49
  34. package/templates/apps/web/app/[locale]/(authed)/leads/__tests__/page.test.tsx +0 -205
  35. package/templates/apps/web/app/[locale]/(authed)/leads/components/LeadsTable.tsx +0 -137
  36. package/templates/apps/web/app/[locale]/(authed)/leads/page.tsx +0 -122
  37. package/templates/apps/web/app/[locale]/(authed)/waitlist/components/ForbiddenState.tsx +0 -24
  38. package/templates/apps/web/app/[locale]/(authed)/waitlist/format.ts +0 -111
  39. package/templates/apps/web/app/[locale]/[slug]/[detail]/__tests__/page.test.tsx +0 -402
  40. package/templates/apps/web/app/[locale]/[slug]/[detail]/page.tsx +0 -143
  41. package/templates/apps/web/app/[locale]/[slug]/__tests__/page.test.tsx +0 -148
  42. package/templates/apps/web/app/[locale]/[slug]/page.tsx +0 -109
  43. package/templates/apps/web/app/[locale]/about/[slug]/page.tsx +0 -46
  44. package/templates/apps/web/app/[locale]/about/__tests__/about-routes.test.tsx +0 -353
  45. package/templates/apps/web/app/[locale]/about/page.tsx +0 -122
  46. package/templates/apps/web/app/[locale]/alternatives/__tests__/page.test.tsx +0 -161
  47. package/templates/apps/web/app/[locale]/alternatives/page.tsx +0 -112
  48. package/templates/apps/web/app/[locale]/careers/[slug]/[action]/page.tsx +0 -244
  49. package/templates/apps/web/app/[locale]/careers/[slug]/apply.actions.ts +0 -325
  50. package/templates/apps/web/app/[locale]/careers/[slug]/job-application-form.ts +0 -120
  51. package/templates/apps/web/app/[locale]/careers/[slug]/page.tsx +0 -73
  52. package/templates/apps/web/app/[locale]/careers/__tests__/apply.actions.test.ts +0 -497
  53. package/templates/apps/web/app/[locale]/careers/__tests__/careers-hub.test.tsx +0 -172
  54. package/templates/apps/web/app/[locale]/careers/__tests__/careers-set.test.tsx +0 -153
  55. package/templates/apps/web/app/[locale]/careers/__tests__/job-application-form.test.ts +0 -141
  56. package/templates/apps/web/app/[locale]/careers/__tests__/job-apply-page.test.tsx +0 -546
  57. package/templates/apps/web/app/[locale]/careers/__tests__/page-renderer-migration.test.tsx +0 -189
  58. package/templates/apps/web/app/[locale]/careers/page.tsx +0 -165
  59. package/templates/apps/web/app/[locale]/case-studies/[slug]/page.tsx +0 -49
  60. package/templates/apps/web/app/[locale]/case-studies/__tests__/hub-children.test.tsx +0 -65
  61. package/templates/apps/web/app/[locale]/case-studies/__tests__/page-renderer-migration.test.tsx +0 -125
  62. package/templates/apps/web/app/[locale]/case-studies/page.tsx +0 -49
  63. package/templates/apps/web/app/[locale]/clients/__tests__/page-renderer-migration.test.tsx +0 -85
  64. package/templates/apps/web/app/[locale]/clients/page.tsx +0 -47
  65. package/templates/apps/web/app/[locale]/contact/ConversationalIntakeWrapper.tsx +0 -249
  66. package/templates/apps/web/app/[locale]/contact/__tests__/ConversationalIntakeWrapper.test.tsx +0 -400
  67. package/templates/apps/web/app/[locale]/contact/__tests__/contact-form-magnet.test.ts +0 -138
  68. package/templates/apps/web/app/[locale]/contact/__tests__/contact-form-text.test.ts +0 -49
  69. package/templates/apps/web/app/[locale]/contact/__tests__/contact-magnet-page.test.tsx +0 -494
  70. package/templates/apps/web/app/[locale]/contact/__tests__/contact.actions.test.ts +0 -1122
  71. package/templates/apps/web/app/[locale]/contact/__tests__/intake-analytics.test.ts +0 -51
  72. package/templates/apps/web/app/[locale]/contact/__tests__/page-renderer-migration.test.tsx +0 -319
  73. package/templates/apps/web/app/[locale]/contact/contact-form-magnet.ts +0 -77
  74. package/templates/apps/web/app/[locale]/contact/contact-form-text.ts +0 -52
  75. package/templates/apps/web/app/[locale]/contact/contact.actions.ts +0 -403
  76. package/templates/apps/web/app/[locale]/contact/intake-analytics.ts +0 -49
  77. package/templates/apps/web/app/[locale]/contact/intake-script.ts +0 -92
  78. package/templates/apps/web/app/[locale]/contact/page.tsx +0 -267
  79. package/templates/apps/web/app/[locale]/courses/[slug]/page.tsx +0 -50
  80. package/templates/apps/web/app/[locale]/courses/__tests__/hub-children.test.tsx +0 -32
  81. package/templates/apps/web/app/[locale]/courses/__tests__/page-renderer-migration.test.tsx +0 -123
  82. package/templates/apps/web/app/[locale]/courses/page.tsx +0 -49
  83. package/templates/apps/web/app/[locale]/events/[slug]/page.tsx +0 -57
  84. package/templates/apps/web/app/[locale]/events/__tests__/hub-children.test.tsx +0 -32
  85. package/templates/apps/web/app/[locale]/events/__tests__/page-renderer-migration.test.tsx +0 -164
  86. package/templates/apps/web/app/[locale]/events/__tests__/program-event.test.tsx +0 -120
  87. package/templates/apps/web/app/[locale]/events/page.tsx +0 -60
  88. package/templates/apps/web/app/[locale]/faq/page.tsx +0 -54
  89. package/templates/apps/web/app/[locale]/features/[slug]/page.tsx +0 -54
  90. package/templates/apps/web/app/[locale]/features/__tests__/hub-children.test.tsx +0 -32
  91. package/templates/apps/web/app/[locale]/features/page.tsx +0 -50
  92. package/templates/apps/web/app/[locale]/for/[slug]/page.tsx +0 -54
  93. package/templates/apps/web/app/[locale]/for/__tests__/hub-children.test.tsx +0 -32
  94. package/templates/apps/web/app/[locale]/for/__tests__/page-renderer-migration.test.tsx +0 -90
  95. package/templates/apps/web/app/[locale]/for/page.tsx +0 -51
  96. package/templates/apps/web/app/[locale]/glossary/page.tsx +0 -53
  97. package/templates/apps/web/app/[locale]/how-to/[slug]/page.tsx +0 -50
  98. package/templates/apps/web/app/[locale]/how-to/__tests__/page-renderer-migration.test.tsx +0 -78
  99. package/templates/apps/web/app/[locale]/how-to/page.tsx +0 -50
  100. package/templates/apps/web/app/[locale]/integrations/[slug]/page.tsx +0 -54
  101. package/templates/apps/web/app/[locale]/integrations/__tests__/hub-children.test.tsx +0 -38
  102. package/templates/apps/web/app/[locale]/integrations/__tests__/page-renderer-migration.test.tsx +0 -141
  103. package/templates/apps/web/app/[locale]/integrations/page.tsx +0 -49
  104. package/templates/apps/web/app/[locale]/launch-service/page.tsx +0 -44
  105. package/templates/apps/web/app/[locale]/newsletter/__tests__/page.test.tsx +0 -236
  106. package/templates/apps/web/app/[locale]/newsletter/page.tsx +0 -179
  107. package/templates/apps/web/app/[locale]/page.tsx +0 -147
  108. package/templates/apps/web/app/[locale]/partners/[slug]/page.tsx +0 -45
  109. package/templates/apps/web/app/[locale]/partners/__tests__/hub-children.test.tsx +0 -32
  110. package/templates/apps/web/app/[locale]/partners/__tests__/page-renderer-migration.test.tsx +0 -125
  111. package/templates/apps/web/app/[locale]/partners/page.tsx +0 -49
  112. package/templates/apps/web/app/[locale]/portfolio/[slug]/page.tsx +0 -46
  113. package/templates/apps/web/app/[locale]/portfolio/__tests__/hub-children.test.tsx +0 -38
  114. package/templates/apps/web/app/[locale]/portfolio/page.tsx +0 -50
  115. package/templates/apps/web/app/[locale]/pricing/[slug]/__tests__/page.test.tsx +0 -324
  116. package/templates/apps/web/app/[locale]/pricing/[slug]/page.tsx +0 -87
  117. package/templates/apps/web/app/[locale]/pricing/__tests__/__snapshots__/unconnected.test.tsx.snap +0 -7
  118. package/templates/apps/web/app/[locale]/pricing/__tests__/offerings.test.tsx +0 -605
  119. package/templates/apps/web/app/[locale]/pricing/__tests__/page.test.tsx +0 -219
  120. package/templates/apps/web/app/[locale]/pricing/__tests__/pricing-pages.test.tsx +0 -215
  121. package/templates/apps/web/app/[locale]/pricing/__tests__/unconnected.test.tsx +0 -282
  122. package/templates/apps/web/app/[locale]/pricing/page.tsx +0 -120
  123. package/templates/apps/web/app/[locale]/privacy/page.tsx +0 -40
  124. package/templates/apps/web/app/[locale]/products/[slug]/page.tsx +0 -50
  125. package/templates/apps/web/app/[locale]/products/__tests__/hub-children.test.tsx +0 -32
  126. package/templates/apps/web/app/[locale]/products/__tests__/page-renderer-migration.test.tsx +0 -141
  127. package/templates/apps/web/app/[locale]/products/page.tsx +0 -49
  128. package/templates/apps/web/app/[locale]/projects/[slug]/page.tsx +0 -37
  129. package/templates/apps/web/app/[locale]/projects/__tests__/hub-children.test.tsx +0 -32
  130. package/templates/apps/web/app/[locale]/projects/__tests__/page-renderer-migration.test.tsx +0 -157
  131. package/templates/apps/web/app/[locale]/projects/page.tsx +0 -49
  132. package/templates/apps/web/app/[locale]/purchase-policy/page.tsx +0 -49
  133. package/templates/apps/web/app/[locale]/resources/[slug]/page.tsx +0 -54
  134. package/templates/apps/web/app/[locale]/resources/__tests__/hub-children.test.tsx +0 -38
  135. package/templates/apps/web/app/[locale]/resources/__tests__/page-renderer-migration.test.tsx +0 -151
  136. package/templates/apps/web/app/[locale]/resources/page.tsx +0 -49
  137. package/templates/apps/web/app/[locale]/services/[slug]/[child]/page.tsx +0 -68
  138. package/templates/apps/web/app/[locale]/services/[slug]/page.tsx +0 -88
  139. package/templates/apps/web/app/[locale]/services/__tests__/hub-children.test.tsx +0 -158
  140. package/templates/apps/web/app/[locale]/services/__tests__/page-renderer-migration.test.tsx +0 -187
  141. package/templates/apps/web/app/[locale]/services/__tests__/service-detail-sections.test.tsx +0 -224
  142. package/templates/apps/web/app/[locale]/services/__tests__/service-families.test.tsx +0 -368
  143. package/templates/apps/web/app/[locale]/services/page.tsx +0 -71
  144. package/templates/apps/web/app/[locale]/software/[slug]/page.tsx +0 -49
  145. package/templates/apps/web/app/[locale]/software/__tests__/page-renderer-migration.test.tsx +0 -81
  146. package/templates/apps/web/app/[locale]/software/page.tsx +0 -49
  147. package/templates/apps/web/app/[locale]/team/[slug]/page.tsx +0 -45
  148. package/templates/apps/web/app/[locale]/team/__tests__/hub-children.test.tsx +0 -32
  149. package/templates/apps/web/app/[locale]/team/__tests__/team-routes.test.tsx +0 -161
  150. package/templates/apps/web/app/[locale]/team/page.tsx +0 -50
  151. package/templates/apps/web/app/[locale]/tech-articles/[slug]/page.tsx +0 -54
  152. package/templates/apps/web/app/[locale]/tech-articles/__tests__/page-renderer-migration.test.tsx +0 -82
  153. package/templates/apps/web/app/[locale]/tech-articles/page.tsx +0 -49
  154. package/templates/apps/web/app/[locale]/templates/[slug]/__tests__/page.test.tsx +0 -203
  155. package/templates/apps/web/app/[locale]/templates/[slug]/page.tsx +0 -81
  156. package/templates/apps/web/app/[locale]/templates/__tests__/page.test.tsx +0 -237
  157. package/templates/apps/web/app/[locale]/templates/page.tsx +0 -114
  158. package/templates/apps/web/app/[locale]/terms/page.tsx +0 -40
  159. package/templates/apps/web/app/[locale]/testimonials/__tests__/page-renderer-migration.test.tsx +0 -85
  160. package/templates/apps/web/app/[locale]/testimonials/page.tsx +0 -51
  161. package/templates/apps/web/app/[locale]/thanks/[slug]/__tests__/page.test.tsx +0 -136
  162. package/templates/apps/web/app/[locale]/thanks/[slug]/page.tsx +0 -39
  163. package/templates/apps/web/app/[locale]/unsubscribe/__tests__/unsubscribe-rsc-boundary.test.tsx +0 -226
  164. package/templates/apps/web/app/[locale]/unsubscribe/__tests__/unsubscribe.test.tsx +0 -217
  165. package/templates/apps/web/app/[locale]/unsubscribe/page.tsx +0 -106
  166. package/templates/apps/web/app/[locale]/unsubscribe/unsubscribe-button.tsx +0 -94
  167. package/templates/apps/web/app/[locale]/unsubscribe/unsubscribe.actions.ts +0 -55
  168. package/templates/apps/web/app/[locale]/vs/[slug]/__tests__/page.test.tsx +0 -100
  169. package/templates/apps/web/app/[locale]/vs/[slug]/page.tsx +0 -60
  170. package/templates/apps/web/app/[locale]/whitepapers/[slug]/page.tsx +0 -54
  171. package/templates/apps/web/app/[locale]/whitepapers/__tests__/page-renderer-migration.test.tsx +0 -82
  172. package/templates/apps/web/app/[locale]/whitepapers/page.tsx +0 -49
  173. package/templates/apps/web/app/[locale]/working-agreement/__tests__/page.test.tsx +0 -63
  174. package/templates/apps/web/app/[locale]/working-agreement/page.tsx +0 -41
  175. package/templates/apps/web/lib/__tests__/hub-children.fixtures.ts +0 -279
  176. package/templates/apps/web/lib/__tests__/route-family.test.ts +0 -57
  177. package/templates/apps/web/lib/__tests__/service-listing.test.ts +0 -111
  178. package/templates/apps/web/lib/__tests__/template-listing.test.ts +0 -158
  179. package/templates/apps/web/lib/hub-children.tsx +0 -351
  180. package/templates/apps/web/lib/meet-placeholder.ts +0 -5
  181. package/templates/apps/web/lib/posting-title.ts +0 -39
  182. package/templates/apps/web/lib/route-family.ts +0 -69
  183. package/templates/apps/web/lib/service-listing.ts +0 -89
  184. package/templates/apps/web/lib/template-listing.ts +0 -169
  185. package/templates/apps/web/src/lib/__tests__/lead-write.test.ts +0 -187
  186. package/templates/apps/web/src/lib/lead-write.ts +0 -90
  187. /package/templates/apps/web/{app/[locale]/contact → lib}/__tests__/site-contact-lines.test.ts +0 -0
@@ -1,32 +0,0 @@
1
- /**
2
- * Hub child cards (#10121) for /team. The shared cases live in
3
- * `lib/__tests__/hub-children.fixtures.ts`; this file sits beside the route so
4
- * a scaffold without /team drops it with the route (#10157).
5
- */
6
- const mockRenderPage = jest.fn(async (..._args: unknown[]) => "<rendered/>");
7
-
8
- jest.mock("@working-theory/page-renderer", () => ({
9
- __esModule: true,
10
- renderPage: (...args: unknown[]) => mockRenderPage(...args),
11
- renderPageMetadata: jest.fn(),
12
- // Never reached — every call in this suite passes its loaders via DI.
13
- getMdxSlugs: jest.fn(),
14
- getMdxSource: jest.fn(),
15
- getPageSections: jest.fn(),
16
- }));
17
-
18
- jest.mock("@working-theory/ui/sections", () => ({
19
- __esModule: true,
20
- SectionRenderer: () => null,
21
- }));
22
-
23
- import TeamPage from "../page";
24
- import {
25
- describeHub,
26
- type HubPage,
27
- } from "../../../../lib/__tests__/hub-children.fixtures";
28
-
29
- describeHub(
30
- ["team", TeamPage as HubPage, "TeamList", "TeamMember", "composed"],
31
- mockRenderPage,
32
- );
@@ -1,161 +0,0 @@
1
- /**
2
- * The team routes (#7744 D2, AC-1): `/team/<slug>` renders a profile whose
3
- * JSON-LD is a `ProfilePage` with a `Person` main entity carrying the
4
- * page-scoped `@id`, valid under the schema validator; an unknown slug 404s
5
- * through `renderPage`; `/team` emits a valid `TeamList` block.
6
- *
7
- * MDX sources are inline stubs (no fs reads), so the suite runs unchanged
8
- * inside a scaffold.
9
- */
10
- import React from "react";
11
- import { render } from "@testing-library/react";
12
- import {
13
- validateBlock,
14
- validatePageGraph,
15
- } from "@working-theory/schema-validator";
16
-
17
- jest.mock("next/navigation", () => ({
18
- __esModule: true,
19
- notFound: jest.fn(() => {
20
- throw new Error("NEXT_NOT_FOUND");
21
- }),
22
- }));
23
-
24
- jest.mock("next-mdx-remote/rsc", () => ({
25
- __esModule: true,
26
- MDXRemote: ({ source }: { source: string }) =>
27
- React.createElement("div", { "data-testid": "mdx-rendered" }, source),
28
- }));
29
-
30
- import TeamPage from "../page";
31
- import TeamMemberPage from "../[slug]/page";
32
- import * as pageRenderer from "@working-theory/page-renderer";
33
-
34
- // #10704 — a fixture suite: its content is shaped for the mdx source, whatever the site serves from.
35
- process.env.CONTENT_ADAPTER = "mdx";
36
-
37
- type JsonLd = Record<string, unknown>;
38
-
39
- function jsonLdScripts(container: HTMLElement): JsonLd[] {
40
- return [
41
- ...container.querySelectorAll("script[type='application/ld+json']"),
42
- ].map((s) => JSON.parse(s.textContent ?? "") as JsonLd);
43
- }
44
-
45
- const FIRST_MEMBER = {
46
- frontmatter: {
47
- type: "TeamMember",
48
- slug: "first-member",
49
- title: "{First team member's name}",
50
- description: "{One sentence on who they are and what they do here}",
51
- schema: { jobTitle: "{Their title}" },
52
- },
53
- body: "{Two or three sentences on what they do here.}",
54
- };
55
-
56
- describe("team/[slug] — the profile page", () => {
57
- it("emits one ProfilePage graph whose Person carries @id #person, valid under the schema validator", async () => {
58
- const element = await TeamMemberPage({
59
- params: Promise.resolve({ locale: "en", slug: "first-member" }),
60
- getMdxSource: jest.fn().mockResolvedValue(FIRST_MEMBER),
61
- });
62
- const { container } = render(element);
63
- const scripts = jsonLdScripts(container);
64
- expect(scripts).toHaveLength(1);
65
- const graph = scripts[0]!["@graph"] as JsonLd[];
66
- expect(validatePageGraph(graph as never, "TeamMember")).toEqual(
67
- expect.objectContaining({ valid: true }),
68
- );
69
-
70
- const profile = graph.find((b) => b["@type"] === "ProfilePage")!;
71
- const person = profile["mainEntity"] as JsonLd;
72
- expect(person["@type"]).toBe("Person");
73
- expect(person["@id"]).toBe("#person");
74
- // The seed's `jobTitle` is a `{placeholder}` slot, which never reaches the
75
- // graph (#8797 D8.5).
76
- expect(FIRST_MEMBER.frontmatter.schema.jobTitle).toBe("{Their title}");
77
- expect(person).not.toHaveProperty("jobTitle");
78
-
79
- const breadcrumb = graph.find((b) => b["@type"] === "BreadcrumbList")!;
80
- const items = breadcrumb["itemListElement"] as Array<{ item: string }>;
81
- expect(items[1]!.item).toMatch(/\/en\/team$/);
82
- });
83
-
84
- it("renders a sections-carrying profile (the _base seed's shape) through its content-block, with the same valid graph", async () => {
85
- const element = await TeamMemberPage({
86
- params: Promise.resolve({ locale: "en", slug: "first-member" }),
87
- getMdxSource: jest.fn().mockResolvedValue({
88
- ...FIRST_MEMBER,
89
- frontmatter: {
90
- ...FIRST_MEMBER.frontmatter,
91
- sections: [
92
- {
93
- id: "profile",
94
- type: "content-block",
95
- data: {
96
- headline: FIRST_MEMBER.frontmatter.title,
97
- body: "{Two or three sentences on what they do here.}",
98
- },
99
- },
100
- ],
101
- },
102
- }),
103
- });
104
- const { container } = render(element);
105
- expect(container.querySelector("[data-testid='mdx-body']")).toBeNull();
106
- expect(container.textContent).toContain(
107
- "{Two or three sentences on what they do here.}",
108
- );
109
- const graph = jsonLdScripts(container)[0]!["@graph"] as JsonLd[];
110
- expect(validatePageGraph(graph as never, "TeamMember")).toEqual(
111
- expect.objectContaining({ valid: true }),
112
- );
113
- });
114
-
115
- it("404s an unknown slug through renderPage, with no translations namespace", async () => {
116
- const renderPageSpy = jest.spyOn(pageRenderer, "renderPage");
117
- await expect(
118
- TeamMemberPage({
119
- params: Promise.resolve({ locale: "en", slug: "unknown" }),
120
- getMdxSource: jest.fn().mockResolvedValue(null),
121
- }),
122
- ).rejects.toThrow("NEXT_NOT_FOUND");
123
- expect(renderPageSpy).toHaveBeenCalledTimes(1);
124
- expect(renderPageSpy.mock.calls[0]![0].translationsNamespace).toBeUndefined();
125
- renderPageSpy.mockRestore();
126
- });
127
- });
128
-
129
- describe("team — the index page", () => {
130
- it("emits a block the schema validator accepts as TeamList", async () => {
131
- const element = await TeamPage({
132
- params: Promise.resolve({ locale: "en" }),
133
- getMdxSource: jest.fn().mockResolvedValue({
134
- frontmatter: {
135
- type: "TeamList",
136
- slug: "team",
137
- title: "Team",
138
- description: "The people behind the work.",
139
- },
140
- body: "The team.",
141
- }),
142
- });
143
- const { container } = render(element);
144
- const scripts = jsonLdScripts(container);
145
- expect(scripts).toHaveLength(1);
146
- expect(validateBlock(scripts[0] as never, "TeamList")).toEqual(
147
- expect.objectContaining({ valid: true }),
148
- );
149
- });
150
-
151
- it("renders the empty state from the team namespace when the page is missing", async () => {
152
- const element = await TeamPage({
153
- params: Promise.resolve({ locale: "en" }),
154
- getMdxSource: jest.fn().mockResolvedValue(null),
155
- });
156
- const { getByTestId } = render(element);
157
- expect(getByTestId("section-empty-state").textContent).toBe(
158
- "Team listing coming soon.",
159
- );
160
- });
161
- });
@@ -1,50 +0,0 @@
1
- // Team list page (#7744 D2). Reads TeamList MDX via the content adapter and emits
2
- // a JSON-LD CollectionPage via the dispatcher. The /for composed pattern:
3
- // sections when the frontmatter carries `sections[]`, MDX prose otherwise.
4
- // It lists every TeamMember page through one generated card section (#10121,
5
- // apps/web/lib/hub-children.tsx — the /alternatives and /templates shape).
6
- import type {
7
- getMdxSlugs as defaultGetMdxSlugs,
8
- getMdxSource as defaultGetMdxSource,
9
- getPageSections as defaultGetPageSections,
10
- } from "@working-theory/page-renderer";
11
- import { renderPage, renderPageMetadata } from "@working-theory/page-renderer";
12
- import type { Metadata } from "next";
13
- import type { ReactElement } from "react";
14
-
15
- import { type HubConfig, hubPageInput } from "../../../lib/hub-children";
16
-
17
- interface Props {
18
- params: Promise<{ locale: string }>;
19
- getMdxSource?: typeof defaultGetMdxSource;
20
- getPageSections?: typeof defaultGetPageSections;
21
- getMdxSlugs?: typeof defaultGetMdxSlugs;
22
- }
23
-
24
- const HUB: HubConfig = {
25
- listType: "TeamList",
26
- slug: "team",
27
- childType: "TeamMember",
28
- linkLabel: "View profile",
29
- sectionId: "team-member-cards",
30
- body: "composed",
31
- };
32
-
33
- export async function generateMetadata({
34
- params,
35
- }: Pick<Props, "params">): Promise<Metadata> {
36
- const { locale } = await params;
37
- return renderPageMetadata({ type: "TeamList", slug: "team", locale });
38
- }
39
-
40
- export default async function Page({
41
- params,
42
- ...loaders
43
- }: Props): Promise<ReactElement> {
44
- const { locale } = await params;
45
- return renderPage({
46
- type: "TeamList",
47
- slug: "team",
48
- ...(await hubPageInput(HUB, locale, loaders)),
49
- });
50
- }
@@ -1,54 +0,0 @@
1
- // TechArticle detail page. Reads the TechArticle MDX for the given slug, renders via
2
- // @working-theory/page-renderer, and emits a JSON-LD <script>. Unknown slugs trigger 404.
3
- import type { getMdxSource as defaultGetMdxSource } from "@working-theory/page-renderer";
4
- import {
5
- getMdxSource as loadMdxSource,
6
- renderPage,
7
- renderPageMetadata,
8
- } from "@working-theory/page-renderer";
9
- import type { Metadata } from "next";
10
- import type { ReactElement } from "react";
11
-
12
- interface Props {
13
- params: Promise<{ locale: string; slug: string }>;
14
- getMdxSource?: typeof defaultGetMdxSource;
15
- }
16
-
17
- export async function generateMetadata({
18
- params,
19
- }: Pick<Props, "params">): Promise<Metadata> {
20
- const { locale, slug } = await params;
21
- return renderPageMetadata({ type: "TechArticle", slug, locale });
22
- }
23
-
24
- export default async function Page({
25
- params,
26
- getMdxSource,
27
- }: Props): Promise<ReactElement> {
28
- const { locale, slug } = await params;
29
- // A page that composes `sections[]` renders them (JSON-LD is built from
30
- // the same sections); a prose page renders its MDX body — the rule
31
- // /vs/[slug] applies (#10122).
32
- const source = await (getMdxSource ?? loadMdxSource)(
33
- "TechArticle",
34
- slug,
35
- locale,
36
- );
37
- const composed =
38
- source !== null &&
39
- Array.isArray((source.frontmatter as { sections?: unknown[] }).sections) &&
40
- ((source.frontmatter as { sections?: unknown[] }).sections?.length ?? 0) >
41
- 0;
42
- return renderPage({
43
- type: "TechArticle",
44
- slug,
45
- locale,
46
- ...(composed
47
- ? {}
48
- : {
49
- bodyMode: "mdx-body" as const,
50
- populatedDescriptionTestId: "tech-article-description",
51
- }),
52
- ...(getMdxSource !== undefined && { getMdxSource }),
53
- });
54
- }
@@ -1,82 +0,0 @@
1
- /**
2
- * HTML snapshot regression tests for tech-articles/[slug] — @working-theory/page-renderer migration.
3
- *
4
- * Node version: captured against Node 22.x (same as CI).
5
- * MDX seed content: DI-injected stub — no fs reads, deterministic.
6
- *
7
- * Two-commit strategy:
8
- * Commit 1: this file added; snapshots captured against pre-migration routes.
9
- * Commit 2: routes migrated; same snapshots verify diff=0.
10
- *
11
- * Routes covered:
12
- * - tech-articles/[slug] (populated: populated state)
13
- * - tech-articles/[slug] (notFound: unknown slug triggers notFound())
14
- *
15
- * Note: tech-articles/page.tsx is a slug-listing route (not MDX-body); only the
16
- * import path changes. No snapshot tests needed for tech-articles/page.
17
- *
18
- * Failure = snapshot diff > 0 bytes. DO NOT regenerate snapshots to pass.
19
- * A non-zero diff indicates a behavior regression in the migration. Escalate.
20
- */
21
- import React from "react";
22
- import { render } from "@testing-library/react";
23
-
24
- jest.mock("next-mdx-remote/rsc", () => ({
25
- __esModule: true,
26
- MDXRemote: ({ source }: { source: string }): React.ReactElement =>
27
- React.createElement("div", { "data-testid": "mdx-rendered" }, source),
28
- }));
29
-
30
- jest.mock("next/navigation", () => ({
31
- __esModule: true,
32
- notFound: jest.fn(() => {
33
- throw new Error("NEXT_NOT_FOUND");
34
- }),
35
- }));
36
-
37
- import TechArticleSlugPage from "../[slug]/page";
38
- import { notFound } from "next/navigation";
39
-
40
- const mockNotFound = notFound as jest.MockedFunction<typeof notFound>;
41
-
42
- describe("tech-articles/[slug] — snapshot regression", () => {
43
- beforeEach(() => {
44
- mockNotFound.mockClear();
45
- });
46
-
47
- it("populated state renders deterministic HTML", async () => {
48
- const getMdxSource = jest.fn().mockResolvedValue({
49
- frontmatter: {
50
- type: "TechArticle" as const,
51
- slug: "aeo-layer1-scoring",
52
- title: "AEO Layer 1 Scoring",
53
- description:
54
- "Deep dive into AEO Layer 1 scoring and AILK audit internals.",
55
- },
56
- body: "## AEO Layer 1\n\nBody content.",
57
- });
58
-
59
- const element = await TechArticleSlugPage({
60
- params: Promise.resolve({ locale: "en", slug: "aeo-layer1-scoring" }),
61
- getMdxSource,
62
- });
63
- const { container } = render(element);
64
- expect(container.innerHTML).toMatchInlineSnapshot(`
65
- "<script type="application/ld+json" data-testid="json-ld">{"@context":"https://schema.org","@graph":[{"@context":"https://schema.org","@type":"WebPage","inLanguage":"en","name":"AEO Layer 1 Scoring","description":"Deep dive into AEO Layer 1 scoring and AILK audit internals.","mainEntity":{"@context":"https://schema.org","@type":"TechArticle","headline":"AEO Layer 1 Scoring","description":"Deep dive into AEO Layer 1 scoring and AILK audit internals."}},{"@context":"https://schema.org","@type":"BreadcrumbList","inLanguage":"en","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"http://localhost:3000/en/"},{"@type":"ListItem","position":2,"name":"Tech Articles","item":"http://localhost:3000/en/tech-articles"},{"@type":"ListItem","position":3,"name":"AEO Layer 1 Scoring","item":"http://localhost:3000/en/tech-articles/aeo-layer1-scoring"}]}]}</script><main id="main"><div class="mx-auto w-full max-w-container-xl px-4 md:px-6 lg:px-8 py-section"><div data-testid="markdown-view-toggle" class="ailk-markdown-view-toggle"><div class="flex justify-end mb-3"><div role="radiogroup" aria-label="Page view" data-testid="markdown-view-toggle" class="inline-flex items-center gap-0.5 rounded-lg p-1 bg-(--color-surface-secondary)"><button class="inline-flex items-center justify-center gap-2 font-medium motion-safe:transition motion-safe:duration-(--button-hover-duration) focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-(--color-accent) focus-visible:ring-offset-1 disabled:cursor-not-allowed disabled:opacity-50 [&amp;>svg]:shrink-0 text-(--color-fg) not-disabled:hover:bg-(--button-hover-quiet-bg) not-disabled:hover:text-(--button-hover-quiet-fg) not-disabled:hover:opacity-(--button-hover-opacity) not-disabled:hover:transform-(--button-hover-transform) not-disabled:hover:shadow-(--button-hover-shadow) not-disabled:active:bg-gray-200 not-disabled:active:text-(--color-fg) rounded-control px-control-x h-(--control-height-thin) text-caption leading-none rounded-md px-3 text-body-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-(--color-accent) focus-visible:ring-offset-1 min-w-(--control-height-thin) min-h-(--control-height-big) bg-(--color-bg) text-(--color-fg) shadow-sm" type="button" role="radio" aria-checked="true" aria-label="Rendered" tabindex="0" data-testid="markdown-view-toggle-rendered">Rendered</button><button class="inline-flex items-center justify-center gap-2 font-medium motion-safe:transition motion-safe:duration-(--button-hover-duration) focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-(--color-accent) focus-visible:ring-offset-1 disabled:cursor-not-allowed disabled:opacity-50 [&amp;>svg]:shrink-0 text-(--color-fg) not-disabled:hover:bg-(--button-hover-quiet-bg) not-disabled:hover:text-(--button-hover-quiet-fg) not-disabled:hover:opacity-(--button-hover-opacity) not-disabled:hover:transform-(--button-hover-transform) not-disabled:hover:shadow-(--button-hover-shadow) not-disabled:active:bg-gray-200 not-disabled:active:text-(--color-fg) rounded-control px-control-x h-(--control-height-thin) text-caption leading-none rounded-md px-3 text-body-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-(--color-accent) focus-visible:ring-offset-1 min-w-(--control-height-thin) min-h-(--control-height-big) text-(--color-text-muted) hover:text-(--color-fg)" type="button" role="radio" aria-checked="false" aria-label="Markdown" tabindex="-1" data-testid="markdown-view-toggle-markdown">Markdown</button></div></div><div role="status" aria-live="polite" aria-atomic="true" class="sr-only" data-testid="markdown-view-toggle-status">Showing Rendered view</div><div data-testid="markdown-view-rendered"><article data-testid="mdx-body"><div class="ailk-prose max-w-none text-(--color-text-muted) text-body-sm leading-relaxed [&amp;>*:first-child]:mt-0 [&amp;_h2]:mt-block-loose [&amp;_h2]:scroll-mt-24 [&amp;_h2]:text-heading-3 [&amp;_h2]:font-display [&amp;_h2]:text-(--color-fg) [&amp;_h3]:mt-block-loose [&amp;_h3]:scroll-mt-24 [&amp;_h3]:text-heading-4 [&amp;_h3]:font-display [&amp;_h3]:text-(--color-fg) [&amp;_h4]:mt-block-tight [&amp;_h4]:scroll-mt-24 [&amp;_h4]:text-heading-4 [&amp;_h4]:font-display [&amp;_h4]:text-(--color-fg) [&amp;_h5]:mt-block-tight [&amp;_h5]:scroll-mt-24 [&amp;_h5]:text-heading-4 [&amp;_h5]:font-display [&amp;_h5]:text-(--color-fg) [&amp;_h6]:mt-block-tight [&amp;_h6]:scroll-mt-24 [&amp;_h6]:text-heading-4 [&amp;_h6]:font-display [&amp;_h6]:text-(--color-fg) [&amp;_p]:mt-paragraph [&amp;_strong]:font-semibold [&amp;_strong]:text-(--color-fg) [&amp;_em]:italic [&amp;_ul]:mt-paragraph [&amp;_ul]:list-disc [&amp;_ul]:ps-6 [&amp;_ol]:mt-paragraph [&amp;_ol]:list-decimal [&amp;_ol]:ps-6 [&amp;_li]:mt-1 [&amp;_li]:ps-1 [&amp;_li]:marker:text-(--color-text-muted) [&amp;_li>ul]:mt-1 [&amp;_li>ol]:mt-1 [&amp;_blockquote]:mt-paragraph [&amp;_blockquote]:border-s-4 [&amp;_blockquote]:border-(--color-border-strong) [&amp;_blockquote]:ps-4 [&amp;_blockquote]:italic [&amp;_blockquote]:text-(--color-text-muted) [&amp;_hr]:my-block-loose [&amp;_hr]:border-(--color-border) [&amp;_a]:text-(--color-accent) [&amp;_a]:underline [&amp;_a]:underline-offset-4 [&amp;_:not(pre)>code]:rounded [&amp;_:not(pre)>code]:bg-(--color-surface-secondary) [&amp;_:not(pre)>code]:px-1.5 [&amp;_:not(pre)>code]:py-0.5 [&amp;_:not(pre)>code]:text-code [&amp;_:not(pre)>code]:font-mono [&amp;_:not(pre)>code]:text-(--color-fg) [&amp;_pre]:mt-paragraph [&amp;_pre]:overflow-auto [&amp;_pre]:rounded-md [&amp;_pre]:border-hairline [&amp;_pre]:border-(--color-border) [&amp;_pre]:bg-(--color-bg) [&amp;_pre]:p-4 [&amp;_pre]:font-mono [&amp;_pre]:text-body-sm [&amp;_img]:mt-paragraph [&amp;_img]:h-auto [&amp;_img]:max-w-full [&amp;_img]:rounded-lg [&amp;_table]:mt-paragraph [&amp;_table]:w-full [&amp;_table]:border-collapse [&amp;_table]:text-body-sm [&amp;_th]:border-b [&amp;_th]:border-(--color-border) [&amp;_th]:bg-(--color-surface-secondary) [&amp;_th]:px-3 [&amp;_th]:py-2 [&amp;_th]:text-start [&amp;_th]:font-semibold [&amp;_th]:text-(--color-fg) [&amp;_td]:border-b [&amp;_td]:border-(--color-border) [&amp;_td]:px-3 [&amp;_td]:py-2 [&amp;_kbd]:rounded [&amp;_kbd]:border-hairline [&amp;_kbd]:border-(--color-border) [&amp;_kbd]:bg-(--color-surface-secondary) [&amp;_kbd]:px-1.5 [&amp;_kbd]:py-0.5 [&amp;_kbd]:text-caption [&amp;_kbd]:font-mono" data-testid="mdx-content"><div data-testid="mdx-rendered">## AEO Layer 1
66
-
67
- Body content.</div></div></article></div></div></div></main>"
68
- `);
69
- });
70
-
71
- it("unknown slug triggers notFound()", async () => {
72
- const getMdxSource = jest.fn().mockResolvedValue(null);
73
-
74
- await expect(
75
- TechArticleSlugPage({
76
- params: Promise.resolve({ locale: "en", slug: "unknown-slug" }),
77
- getMdxSource,
78
- }),
79
- ).rejects.toThrow("NEXT_NOT_FOUND");
80
- expect(mockNotFound).toHaveBeenCalled();
81
- });
82
- });
@@ -1,49 +0,0 @@
1
- // Tech Articles list page. Enumerates TechArticle slugs via the content adapter
2
- // and renders a directory listing. No dedicated list MDX type exists for TechArticle.
3
- import { getMdxSlugs as defaultGetMdxSlugs } from "@working-theory/page-renderer";
4
- import { LinkListItem, RowGroup } from "@working-theory/ui/blocks";
5
- import { Container, Heading, Text } from "@working-theory/ui/primitives";
6
- import { getTranslations } from "next-intl/server";
7
- import type { ReactElement } from "react";
8
-
9
- interface Props {
10
- params: Promise<{ locale: string }>;
11
- getMdxSlugs?: typeof defaultGetMdxSlugs;
12
- }
13
-
14
- export default async function Page({
15
- params,
16
- getMdxSlugs = defaultGetMdxSlugs,
17
- }: Props): Promise<ReactElement> {
18
- const { locale } = await params;
19
- const t = await getTranslations("tech-articles");
20
- const slugs = await getMdxSlugs("TechArticle", locale);
21
-
22
- return (
23
- <main>
24
- <Container className="py-section">
25
- <Heading level={1}>{t("heading")}</Heading>
26
- <div data-testid="tech-articles-description">
27
- <Text>{t("description")}</Text>
28
- </div>
29
- {slugs.length === 0 ? (
30
- <div data-testid="section-empty-state">
31
- <Text>{t("emptyState")}</Text>
32
- </div>
33
- ) : (
34
- <RowGroup data-testid="tech-articles-list">
35
- {slugs.map((slug) => (
36
- <LinkListItem
37
- key={slug}
38
- href={`/${locale}/tech-articles/${slug}`}
39
- label={slug}
40
- className="px-4"
41
- data-testid={`tech-articles-list-item-${slug}`}
42
- />
43
- ))}
44
- </RowGroup>
45
- )}
46
- </Container>
47
- </main>
48
- );
49
- }
@@ -1,203 +0,0 @@
1
- /**
2
- * Tests for /templates/[slug] (#10051 D7, AC-5) — the TemplatePage detail
3
- * route. `renderPage`/`renderPageMetadata` are mocked at the
4
- * `@working-theory/page-renderer` boundary (the /vs/[slug] shape) and each
5
- * assertion inspects the sections the route hands `renderPage`; the unknown-
6
- * slug case runs the real `renderPage` so its notFound() is observed. The
7
- * JSON-LD is the real builder over the real `toContentPageInput`, the path
8
- * `renderPage` takes.
9
- */
10
-
11
- const mockRenderPage = jest.fn(
12
- async (..._args: unknown[]): Promise<unknown> => "<rendered/>",
13
- );
14
- const mockRenderPageMetadata = jest.fn((..._args: unknown[]) => undefined);
15
- const mockNotFound = jest.fn(() => {
16
- throw new Error("NEXT_NOT_FOUND");
17
- });
18
-
19
- jest.mock("next/navigation", () => ({
20
- __esModule: true,
21
- notFound: () => mockNotFound(),
22
- redirect: jest.fn(),
23
- }));
24
-
25
- jest.mock("@working-theory/page-renderer", () => ({
26
- ...jest.requireActual("@working-theory/page-renderer"),
27
- renderPage: (...args: unknown[]) => mockRenderPage(...args),
28
- renderPageMetadata: (...args: unknown[]) => mockRenderPageMetadata(...args),
29
- }));
30
-
31
- const MESSAGES: Record<string, string> = {
32
- getIt: "Get it",
33
- startFree: "Start free",
34
- viewDemo: "View demo",
35
- viewTemplate: "View template",
36
- included: "What's included",
37
- demoBadge: "Live demo",
38
- };
39
-
40
- jest.mock("next-intl/server", () => ({
41
- __esModule: true,
42
- getTranslations: () => Promise.resolve((key: string) => MESSAGES[key] ?? key),
43
- }));
44
-
45
- import { pageToJsonLd } from "@working-theory/page-renderer";
46
-
47
- import TemplateDetailPage, { generateMetadata } from "../page";
48
-
49
- const A = {
50
- type: "TemplatePage",
51
- slug: "a",
52
- title: "Template A",
53
- description: "Description A.",
54
- summary: "Summary A.",
55
- price: 0,
56
- priceCurrency: "USD",
57
- demoUrl: "https://a.salessmyth.com",
58
- categories: ["accounting"],
59
- thumbnail: "/img/a.png",
60
- getItUrl: "/contact",
61
- includes: [
62
- { title: "Base site", description: "Pages and structured data." },
63
- { title: "Marketing", description: "Landing pages." },
64
- ],
65
- };
66
-
67
- const B = {
68
- type: "TemplatePage",
69
- slug: "b",
70
- title: "Template B",
71
- description: "Description B.",
72
- getItUrl: "/contact",
73
- includes: [{ title: "Base site", description: "Pages and structured data." }],
74
- };
75
-
76
- type Section = { type: string; id: string; data: Record<string, unknown> };
77
-
78
- async function sectionsFor(
79
- frontmatter: Record<string, unknown>,
80
- declared: Section[] = [],
81
- ) {
82
- await TemplateDetailPage({
83
- params: Promise.resolve({ locale: "en", slug: String(frontmatter.slug) }),
84
- getMdxSource: jest
85
- .fn()
86
- .mockResolvedValue({ frontmatter, body: "" }) as never,
87
- getPageSections: jest.fn(async () => declared) as never,
88
- });
89
- const input = mockRenderPage.mock.calls[0]![0] as {
90
- type: string;
91
- translationsNamespace?: string;
92
- getPageSections: (fm: unknown) => Promise<Section[]>;
93
- };
94
- return { input, sections: await input.getPageSections(frontmatter) };
95
- }
96
-
97
- beforeEach(() => jest.clearAllMocks());
98
-
99
- describe("TemplatePage detail — metadata", () => {
100
- it("resolves metadata for the given slug", async () => {
101
- await generateMetadata({
102
- params: Promise.resolve({ locale: "en", slug: "a" }),
103
- });
104
- expect(mockRenderPageMetadata).toHaveBeenCalledWith({
105
- type: "TemplatePage",
106
- slug: "a",
107
- locale: "en",
108
- });
109
- });
110
- });
111
-
112
- describe("TemplatePage detail — the generated sections (#10051 AC-5)", () => {
113
- it("renders TemplatePage with no translations namespace", async () => {
114
- const { input } = await sectionsFor(A);
115
- expect(input.type).toBe("TemplatePage");
116
- expect(input.translationsNamespace).toBeUndefined();
117
- });
118
-
119
- it("leads with a hero carrying the title, summary, thumbnail, Start free and View demo", async () => {
120
- const { sections } = await sectionsFor(A);
121
- expect(sections[0]).toMatchObject({
122
- type: "hero",
123
- data: {
124
- headline: "Template A",
125
- subheadline: "Summary A.",
126
- image: { src: "/img/a.png", alt: "Template A" },
127
- primaryCta: { label: "Start free", href: "/contact" },
128
- secondaryCta: { label: "View demo", href: "https://a.salessmyth.com" },
129
- },
130
- });
131
- });
132
-
133
- it("renders What's included with one item per includes row", async () => {
134
- const { sections } = await sectionsFor(A);
135
- const included = sections.find((s) => s.id === "template-included");
136
- expect(included?.data.headline).toBe("What's included");
137
- expect(included?.data.items).toHaveLength(2);
138
- });
139
-
140
- it("renders Get it and no View demo for a priceless page without a demo", async () => {
141
- const { sections } = await sectionsFor(B);
142
- expect(sections[0]!.data.primaryCta).toEqual({
143
- label: "Get it",
144
- href: "/contact",
145
- });
146
- expect(sections[0]!.data).not.toHaveProperty("secondaryCta");
147
- });
148
-
149
- it("keeps an author's own leading hero and still renders What's included", async () => {
150
- const own = {
151
- type: "hero",
152
- id: "own-hero",
153
- data: { headline: "My own hero" },
154
- };
155
- const { sections } = await sectionsFor(A, [own]);
156
- expect(sections.filter((s) => s.type === "hero").map((s) => s.id)).toEqual([
157
- "own-hero",
158
- ]);
159
- // The author's hero leads (spec Clarification); What's included follows it.
160
- expect(sections.map((s) => s.id)).toEqual([
161
- "own-hero",
162
- "template-included",
163
- ]);
164
- });
165
-
166
- it("emits a Product main entity carrying an offers node", async () => {
167
- const emitted = await pageToJsonLd(A as never, "en");
168
- const graph = (emitted as { "@graph"?: unknown[] })["@graph"];
169
- const blocks = (graph ??
170
- (Array.isArray(emitted) ? emitted : [emitted])) as Array<
171
- Record<string, unknown>
172
- >;
173
- const page = blocks.find((b) => b["@type"] === "WebPage") as {
174
- mainEntity: Record<string, unknown>;
175
- };
176
- expect(page.mainEntity["@type"]).toBe("Product");
177
- expect(page.mainEntity.offers).toMatchObject({
178
- "@type": "Offer",
179
- price: "0",
180
- });
181
- expect(String((page.mainEntity.offers as { url: string }).url)).toMatch(
182
- /\/contact$/,
183
- );
184
- });
185
- });
186
-
187
- describe("TemplatePage detail — unknown slug", () => {
188
- it("calls notFound through renderPage's detail branch", async () => {
189
- const actual = jest.requireActual("@working-theory/page-renderer") as {
190
- renderPage: (...args: unknown[]) => Promise<unknown>;
191
- };
192
- mockRenderPage.mockImplementationOnce((...args) =>
193
- actual.renderPage(...args),
194
- );
195
- await expect(
196
- TemplateDetailPage({
197
- params: Promise.resolve({ locale: "en", slug: "no-such-template" }),
198
- getMdxSource: jest.fn().mockResolvedValue(null) as never,
199
- }),
200
- ).rejects.toThrow("NEXT_NOT_FOUND");
201
- expect(mockNotFound).toHaveBeenCalled();
202
- });
203
- });