create-ailk 0.39.0 → 0.40.1

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 (203) hide show
  1. package/component-catalog.json +1 -1
  2. package/component-catalog.md +1 -1
  3. package/dist/add-route.js +15 -0
  4. package/dist/body-heading.d.ts +2 -1
  5. package/dist/body-heading.js +31 -3
  6. package/dist/module-architecture.js +0 -3
  7. package/dist/remove-module.js +13 -4
  8. package/dist/routes.d.ts +7 -0
  9. package/dist/routes.js +1 -1
  10. package/dist/site-roster.js +7 -1
  11. package/dist/surfaces.d.ts +2 -0
  12. package/dist/surfaces.js +59 -172
  13. package/package.json +3 -3
  14. package/templates/apps/web/CLAUDE.md +19 -2
  15. package/templates/apps/web/__tests__/__mocks__/next-intl-server.ts +3 -2
  16. package/templates/apps/web/__tests__/__mocks__/next-intl.ts +3 -2
  17. package/templates/apps/web/app/[locale]/layout.tsx +42 -25
  18. package/templates/apps/web/app/api/revalidate/__tests__/route.test.ts +56 -1
  19. package/templates/apps/web/app/api/revalidate/route.ts +45 -4
  20. package/templates/apps/web/app/llms.txt/__tests__/site-listing.test.ts +53 -0
  21. package/templates/apps/web/app/llms.txt/route.ts +5 -2
  22. package/templates/apps/web/i18n/request.ts +5 -1
  23. package/templates/apps/web/jest.config.cjs +6 -0
  24. package/templates/apps/web/lib/__tests__/deck-page.test.ts +9 -0
  25. package/templates/apps/web/lib/__tests__/hub-site-config.test.ts +239 -0
  26. package/templates/apps/web/lib/__tests__/in-page-magnet-self-request.test.ts +1 -1
  27. package/templates/apps/web/lib/__tests__/in-page-magnet.test.ts +2 -2
  28. package/templates/apps/web/lib/__tests__/pricing-page.test.ts +1 -1
  29. package/templates/apps/web/lib/__tests__/profile-back-link.test.ts +58 -0
  30. package/templates/apps/web/lib/__tests__/served-pages.test.ts +163 -20
  31. package/templates/apps/web/lib/__tests__/site-brand.test.ts +77 -0
  32. package/templates/apps/web/{app/[locale]/contact → lib}/__tests__/site-contact-lines.test.ts +64 -0
  33. package/templates/apps/web/lib/__tests__/site-identity-feature-list.test.ts +115 -3
  34. package/templates/apps/web/lib/__tests__/structured-data.test.tsx +17 -4
  35. package/templates/apps/web/lib/hub-site-config.ts +151 -0
  36. package/templates/apps/web/lib/in-page-magnet.ts +2 -2
  37. package/templates/apps/web/lib/pricing-page.ts +3 -3
  38. package/templates/apps/web/lib/profile-back-link.ts +49 -12
  39. package/templates/apps/web/lib/served-pages.ts +144 -39
  40. package/templates/apps/web/lib/site-brand.tsx +66 -0
  41. package/templates/apps/web/{app/[locale]/contact → lib}/site-contact-email.ts +25 -5
  42. package/templates/apps/web/{app/[locale]/contact → lib}/site-contact-lines.ts +21 -5
  43. package/templates/apps/web/lib/site-header.ts +1 -1
  44. package/templates/apps/web/lib/site-identity.ts +38 -2
  45. package/templates/apps/web/messages/en.json +3 -119
  46. package/templates/apps/web/next.config.mjs +7 -0
  47. package/templates/apps/web/package.json +1 -0
  48. package/templates/apps/web/site-pages.config.tsx +85 -0
  49. package/templates/tools/body-heading.ts +30 -3
  50. package/versions.json +50 -49
  51. package/templates/apps/web/app/[locale]/(authed)/leads/__tests__/page.test.tsx +0 -205
  52. package/templates/apps/web/app/[locale]/(authed)/leads/components/LeadsTable.tsx +0 -137
  53. package/templates/apps/web/app/[locale]/(authed)/leads/page.tsx +0 -122
  54. package/templates/apps/web/app/[locale]/(authed)/waitlist/components/ForbiddenState.tsx +0 -24
  55. package/templates/apps/web/app/[locale]/(authed)/waitlist/format.ts +0 -111
  56. package/templates/apps/web/app/[locale]/[slug]/[detail]/__tests__/page.test.tsx +0 -402
  57. package/templates/apps/web/app/[locale]/[slug]/[detail]/page.tsx +0 -143
  58. package/templates/apps/web/app/[locale]/[slug]/__tests__/page.test.tsx +0 -148
  59. package/templates/apps/web/app/[locale]/[slug]/page.tsx +0 -109
  60. package/templates/apps/web/app/[locale]/about/[slug]/page.tsx +0 -46
  61. package/templates/apps/web/app/[locale]/about/__tests__/about-routes.test.tsx +0 -353
  62. package/templates/apps/web/app/[locale]/about/page.tsx +0 -122
  63. package/templates/apps/web/app/[locale]/alternatives/__tests__/page.test.tsx +0 -161
  64. package/templates/apps/web/app/[locale]/alternatives/page.tsx +0 -112
  65. package/templates/apps/web/app/[locale]/careers/[slug]/[action]/page.tsx +0 -244
  66. package/templates/apps/web/app/[locale]/careers/[slug]/apply.actions.ts +0 -325
  67. package/templates/apps/web/app/[locale]/careers/[slug]/job-application-form.ts +0 -120
  68. package/templates/apps/web/app/[locale]/careers/[slug]/page.tsx +0 -73
  69. package/templates/apps/web/app/[locale]/careers/__tests__/apply.actions.test.ts +0 -497
  70. package/templates/apps/web/app/[locale]/careers/__tests__/careers-hub.test.tsx +0 -172
  71. package/templates/apps/web/app/[locale]/careers/__tests__/careers-set.test.tsx +0 -153
  72. package/templates/apps/web/app/[locale]/careers/__tests__/job-application-form.test.ts +0 -141
  73. package/templates/apps/web/app/[locale]/careers/__tests__/job-apply-page.test.tsx +0 -546
  74. package/templates/apps/web/app/[locale]/careers/__tests__/page-renderer-migration.test.tsx +0 -189
  75. package/templates/apps/web/app/[locale]/careers/page.tsx +0 -165
  76. package/templates/apps/web/app/[locale]/case-studies/[slug]/page.tsx +0 -49
  77. package/templates/apps/web/app/[locale]/case-studies/__tests__/hub-children.test.tsx +0 -65
  78. package/templates/apps/web/app/[locale]/case-studies/__tests__/page-renderer-migration.test.tsx +0 -125
  79. package/templates/apps/web/app/[locale]/case-studies/page.tsx +0 -49
  80. package/templates/apps/web/app/[locale]/clients/__tests__/page-renderer-migration.test.tsx +0 -85
  81. package/templates/apps/web/app/[locale]/clients/page.tsx +0 -47
  82. package/templates/apps/web/app/[locale]/contact/ConversationalIntakeWrapper.tsx +0 -249
  83. package/templates/apps/web/app/[locale]/contact/__tests__/ConversationalIntakeWrapper.test.tsx +0 -400
  84. package/templates/apps/web/app/[locale]/contact/__tests__/contact-form-magnet.test.ts +0 -138
  85. package/templates/apps/web/app/[locale]/contact/__tests__/contact-form-text.test.ts +0 -49
  86. package/templates/apps/web/app/[locale]/contact/__tests__/contact-magnet-page.test.tsx +0 -494
  87. package/templates/apps/web/app/[locale]/contact/__tests__/contact.actions.test.ts +0 -1122
  88. package/templates/apps/web/app/[locale]/contact/__tests__/intake-analytics.test.ts +0 -51
  89. package/templates/apps/web/app/[locale]/contact/__tests__/page-renderer-migration.test.tsx +0 -319
  90. package/templates/apps/web/app/[locale]/contact/contact-form-magnet.ts +0 -77
  91. package/templates/apps/web/app/[locale]/contact/contact-form-text.ts +0 -52
  92. package/templates/apps/web/app/[locale]/contact/contact.actions.ts +0 -403
  93. package/templates/apps/web/app/[locale]/contact/intake-analytics.ts +0 -49
  94. package/templates/apps/web/app/[locale]/contact/intake-script.ts +0 -92
  95. package/templates/apps/web/app/[locale]/contact/page.tsx +0 -267
  96. package/templates/apps/web/app/[locale]/courses/[slug]/page.tsx +0 -50
  97. package/templates/apps/web/app/[locale]/courses/__tests__/hub-children.test.tsx +0 -32
  98. package/templates/apps/web/app/[locale]/courses/__tests__/page-renderer-migration.test.tsx +0 -123
  99. package/templates/apps/web/app/[locale]/courses/page.tsx +0 -49
  100. package/templates/apps/web/app/[locale]/events/[slug]/page.tsx +0 -57
  101. package/templates/apps/web/app/[locale]/events/__tests__/hub-children.test.tsx +0 -32
  102. package/templates/apps/web/app/[locale]/events/__tests__/page-renderer-migration.test.tsx +0 -164
  103. package/templates/apps/web/app/[locale]/events/__tests__/program-event.test.tsx +0 -120
  104. package/templates/apps/web/app/[locale]/events/page.tsx +0 -60
  105. package/templates/apps/web/app/[locale]/faq/page.tsx +0 -54
  106. package/templates/apps/web/app/[locale]/features/[slug]/page.tsx +0 -54
  107. package/templates/apps/web/app/[locale]/features/__tests__/hub-children.test.tsx +0 -32
  108. package/templates/apps/web/app/[locale]/features/page.tsx +0 -50
  109. package/templates/apps/web/app/[locale]/for/[slug]/page.tsx +0 -54
  110. package/templates/apps/web/app/[locale]/for/__tests__/hub-children.test.tsx +0 -32
  111. package/templates/apps/web/app/[locale]/for/__tests__/page-renderer-migration.test.tsx +0 -90
  112. package/templates/apps/web/app/[locale]/for/page.tsx +0 -51
  113. package/templates/apps/web/app/[locale]/glossary/page.tsx +0 -53
  114. package/templates/apps/web/app/[locale]/how-to/[slug]/page.tsx +0 -50
  115. package/templates/apps/web/app/[locale]/how-to/__tests__/page-renderer-migration.test.tsx +0 -78
  116. package/templates/apps/web/app/[locale]/how-to/page.tsx +0 -50
  117. package/templates/apps/web/app/[locale]/integrations/[slug]/page.tsx +0 -54
  118. package/templates/apps/web/app/[locale]/integrations/__tests__/hub-children.test.tsx +0 -38
  119. package/templates/apps/web/app/[locale]/integrations/__tests__/page-renderer-migration.test.tsx +0 -141
  120. package/templates/apps/web/app/[locale]/integrations/page.tsx +0 -49
  121. package/templates/apps/web/app/[locale]/launch-service/page.tsx +0 -44
  122. package/templates/apps/web/app/[locale]/newsletter/__tests__/page.test.tsx +0 -236
  123. package/templates/apps/web/app/[locale]/newsletter/page.tsx +0 -179
  124. package/templates/apps/web/app/[locale]/page.tsx +0 -147
  125. package/templates/apps/web/app/[locale]/partners/[slug]/page.tsx +0 -45
  126. package/templates/apps/web/app/[locale]/partners/__tests__/hub-children.test.tsx +0 -32
  127. package/templates/apps/web/app/[locale]/partners/__tests__/page-renderer-migration.test.tsx +0 -125
  128. package/templates/apps/web/app/[locale]/partners/page.tsx +0 -49
  129. package/templates/apps/web/app/[locale]/portfolio/[slug]/page.tsx +0 -46
  130. package/templates/apps/web/app/[locale]/portfolio/__tests__/hub-children.test.tsx +0 -38
  131. package/templates/apps/web/app/[locale]/portfolio/page.tsx +0 -50
  132. package/templates/apps/web/app/[locale]/pricing/[slug]/__tests__/page.test.tsx +0 -324
  133. package/templates/apps/web/app/[locale]/pricing/[slug]/page.tsx +0 -87
  134. package/templates/apps/web/app/[locale]/pricing/__tests__/__snapshots__/unconnected.test.tsx.snap +0 -7
  135. package/templates/apps/web/app/[locale]/pricing/__tests__/offerings.test.tsx +0 -605
  136. package/templates/apps/web/app/[locale]/pricing/__tests__/page.test.tsx +0 -219
  137. package/templates/apps/web/app/[locale]/pricing/__tests__/pricing-pages.test.tsx +0 -215
  138. package/templates/apps/web/app/[locale]/pricing/__tests__/unconnected.test.tsx +0 -282
  139. package/templates/apps/web/app/[locale]/pricing/page.tsx +0 -120
  140. package/templates/apps/web/app/[locale]/privacy/page.tsx +0 -40
  141. package/templates/apps/web/app/[locale]/products/[slug]/page.tsx +0 -50
  142. package/templates/apps/web/app/[locale]/products/__tests__/hub-children.test.tsx +0 -32
  143. package/templates/apps/web/app/[locale]/products/__tests__/page-renderer-migration.test.tsx +0 -141
  144. package/templates/apps/web/app/[locale]/products/page.tsx +0 -49
  145. package/templates/apps/web/app/[locale]/projects/[slug]/page.tsx +0 -37
  146. package/templates/apps/web/app/[locale]/projects/__tests__/hub-children.test.tsx +0 -32
  147. package/templates/apps/web/app/[locale]/projects/__tests__/page-renderer-migration.test.tsx +0 -157
  148. package/templates/apps/web/app/[locale]/projects/page.tsx +0 -49
  149. package/templates/apps/web/app/[locale]/purchase-policy/page.tsx +0 -49
  150. package/templates/apps/web/app/[locale]/resources/[slug]/page.tsx +0 -54
  151. package/templates/apps/web/app/[locale]/resources/__tests__/hub-children.test.tsx +0 -38
  152. package/templates/apps/web/app/[locale]/resources/__tests__/page-renderer-migration.test.tsx +0 -151
  153. package/templates/apps/web/app/[locale]/resources/page.tsx +0 -49
  154. package/templates/apps/web/app/[locale]/services/[slug]/[child]/page.tsx +0 -68
  155. package/templates/apps/web/app/[locale]/services/[slug]/page.tsx +0 -88
  156. package/templates/apps/web/app/[locale]/services/__tests__/hub-children.test.tsx +0 -158
  157. package/templates/apps/web/app/[locale]/services/__tests__/page-renderer-migration.test.tsx +0 -187
  158. package/templates/apps/web/app/[locale]/services/__tests__/service-detail-sections.test.tsx +0 -224
  159. package/templates/apps/web/app/[locale]/services/__tests__/service-families.test.tsx +0 -368
  160. package/templates/apps/web/app/[locale]/services/page.tsx +0 -71
  161. package/templates/apps/web/app/[locale]/software/[slug]/page.tsx +0 -49
  162. package/templates/apps/web/app/[locale]/software/__tests__/page-renderer-migration.test.tsx +0 -81
  163. package/templates/apps/web/app/[locale]/software/page.tsx +0 -49
  164. package/templates/apps/web/app/[locale]/team/[slug]/page.tsx +0 -45
  165. package/templates/apps/web/app/[locale]/team/__tests__/hub-children.test.tsx +0 -32
  166. package/templates/apps/web/app/[locale]/team/__tests__/team-routes.test.tsx +0 -161
  167. package/templates/apps/web/app/[locale]/team/page.tsx +0 -50
  168. package/templates/apps/web/app/[locale]/tech-articles/[slug]/page.tsx +0 -54
  169. package/templates/apps/web/app/[locale]/tech-articles/__tests__/page-renderer-migration.test.tsx +0 -82
  170. package/templates/apps/web/app/[locale]/tech-articles/page.tsx +0 -49
  171. package/templates/apps/web/app/[locale]/templates/[slug]/__tests__/page.test.tsx +0 -203
  172. package/templates/apps/web/app/[locale]/templates/[slug]/page.tsx +0 -81
  173. package/templates/apps/web/app/[locale]/templates/__tests__/page.test.tsx +0 -237
  174. package/templates/apps/web/app/[locale]/templates/page.tsx +0 -114
  175. package/templates/apps/web/app/[locale]/terms/page.tsx +0 -40
  176. package/templates/apps/web/app/[locale]/testimonials/__tests__/page-renderer-migration.test.tsx +0 -85
  177. package/templates/apps/web/app/[locale]/testimonials/page.tsx +0 -51
  178. package/templates/apps/web/app/[locale]/thanks/[slug]/__tests__/page.test.tsx +0 -136
  179. package/templates/apps/web/app/[locale]/thanks/[slug]/page.tsx +0 -39
  180. package/templates/apps/web/app/[locale]/unsubscribe/__tests__/unsubscribe-rsc-boundary.test.tsx +0 -226
  181. package/templates/apps/web/app/[locale]/unsubscribe/__tests__/unsubscribe.test.tsx +0 -217
  182. package/templates/apps/web/app/[locale]/unsubscribe/page.tsx +0 -106
  183. package/templates/apps/web/app/[locale]/unsubscribe/unsubscribe-button.tsx +0 -94
  184. package/templates/apps/web/app/[locale]/unsubscribe/unsubscribe.actions.ts +0 -55
  185. package/templates/apps/web/app/[locale]/vs/[slug]/__tests__/page.test.tsx +0 -100
  186. package/templates/apps/web/app/[locale]/vs/[slug]/page.tsx +0 -60
  187. package/templates/apps/web/app/[locale]/whitepapers/[slug]/page.tsx +0 -54
  188. package/templates/apps/web/app/[locale]/whitepapers/__tests__/page-renderer-migration.test.tsx +0 -82
  189. package/templates/apps/web/app/[locale]/whitepapers/page.tsx +0 -49
  190. package/templates/apps/web/app/[locale]/working-agreement/__tests__/page.test.tsx +0 -63
  191. package/templates/apps/web/app/[locale]/working-agreement/page.tsx +0 -41
  192. package/templates/apps/web/lib/__tests__/hub-children.fixtures.ts +0 -279
  193. package/templates/apps/web/lib/__tests__/route-family.test.ts +0 -57
  194. package/templates/apps/web/lib/__tests__/service-listing.test.ts +0 -111
  195. package/templates/apps/web/lib/__tests__/template-listing.test.ts +0 -158
  196. package/templates/apps/web/lib/hub-children.tsx +0 -351
  197. package/templates/apps/web/lib/meet-placeholder.ts +0 -5
  198. package/templates/apps/web/lib/posting-title.ts +0 -39
  199. package/templates/apps/web/lib/route-family.ts +0 -69
  200. package/templates/apps/web/lib/service-listing.ts +0 -89
  201. package/templates/apps/web/lib/template-listing.ts +0 -169
  202. package/templates/apps/web/src/lib/__tests__/lead-write.test.ts +0 -187
  203. package/templates/apps/web/src/lib/lead-write.ts +0 -90
@@ -0,0 +1,239 @@
1
+ /**
2
+ * @jest-environment node
3
+ */
4
+
5
+ /**
6
+ * The hub read of the site's identity and seo (#11456, spec
7
+ * docs/specs/11456-a-hub-connected-site-reads-spec.md D3; AC-2, AC-3).
8
+ *
9
+ * External boundaries doubled:
10
+ * - `@working-theory/api-client`'s `siteConfig.get` — the HTTP call to the
11
+ * hub (`sendsSpokeKey` stays real, so the switch is the env's);
12
+ * - `next/cache`'s `unstable_cache` — a fake with Next's write rule: a
13
+ * RESOLVED callback is written, a THROWING one writes nothing and the
14
+ * last entry is served (`unstable-cache.js` `cacheNewResult`).
15
+ */
16
+ import { mkdtempSync, rmSync, writeFileSync } from "node:fs";
17
+ import { tmpdir } from "node:os";
18
+ import { join } from "node:path";
19
+
20
+ const mockGet = jest.fn();
21
+ jest.mock("@working-theory/api-client", () => ({
22
+ ...jest.requireActual("@working-theory/api-client"),
23
+ siteConfig: { get: (...args: unknown[]) => mockGet(...args) },
24
+ }));
25
+
26
+ /** The fake data cache: one entry per joined key parts. */
27
+ const mockCacheStore = new Map<string, unknown>();
28
+ const mockUnstableCache = jest.fn(
29
+ (
30
+ fn: () => Promise<unknown>,
31
+ keyParts: string[],
32
+ _options: { tags: string[]; revalidate: number },
33
+ ) =>
34
+ async () => {
35
+ const key = keyParts.join("|");
36
+ try {
37
+ const value = await fn();
38
+ mockCacheStore.set(key, value);
39
+ return value;
40
+ } catch (err) {
41
+ if (mockCacheStore.has(key)) return mockCacheStore.get(key);
42
+ throw err;
43
+ }
44
+ },
45
+ );
46
+ jest.mock("next/cache", () => ({
47
+ unstable_cache: (...args: Parameters<typeof mockUnstableCache>) =>
48
+ mockUnstableCache(...args),
49
+ }));
50
+
51
+ import { siteConfigTag } from "@working-theory/page-renderer/edge";
52
+
53
+ import {
54
+ __resetHubSiteForTests,
55
+ HUB_SITE_REVALIDATE_SECONDS,
56
+ HUB_SITE_TIMEOUT_MS,
57
+ heldHubSite,
58
+ hubConnected,
59
+ readHubSite,
60
+ } from "../hub-site-config";
61
+ import { readSiteContactEmail } from "../site-contact-email";
62
+
63
+ const KEY = "ailk_spk_TESTKEYxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
64
+ const HUB_IDENTITY = {
65
+ kind: "Person",
66
+ name: "Hub Person",
67
+ url: "https://hub.example",
68
+ email: "hub@hub.example",
69
+ };
70
+ const HUB_SEO = { version: "1", robots: { index: false } };
71
+ const ok = (data: unknown) => ({ ok: true, body: data });
72
+
73
+ const ENV_KEYS = ["CONTENT_ADAPTER", "AILK_SPOKE_KEY", "AILK_API_URL", "AILK_CONTENT_ROOT"] as const;
74
+ const savedEnv = new Map(ENV_KEYS.map((k) => [k, process.env[k]]));
75
+ let root: string;
76
+
77
+ function hubConnect(): void {
78
+ process.env.CONTENT_ADAPTER = "database";
79
+ process.env.AILK_SPOKE_KEY = KEY;
80
+ process.env.AILK_API_URL = "https://hub.example";
81
+ }
82
+
83
+ beforeEach(() => {
84
+ mockGet.mockReset();
85
+ mockUnstableCache.mockClear();
86
+ mockCacheStore.clear();
87
+ __resetHubSiteForTests();
88
+ for (const k of ENV_KEYS) delete process.env[k];
89
+ root = mkdtempSync(join(tmpdir(), "hub-site-config-"));
90
+ process.env.AILK_CONTENT_ROOT = root;
91
+ writeFileSync(
92
+ join(root, "_site.mdx"),
93
+ "---\nsiteName: File Site\ncontactEmail: file@file.example\n---\n",
94
+ );
95
+ jest.spyOn(console, "warn").mockImplementation(() => undefined);
96
+ });
97
+
98
+ afterEach(() => {
99
+ jest.restoreAllMocks();
100
+ jest.useRealTimers();
101
+ rmSync(root, { recursive: true, force: true });
102
+ for (const [k, v] of savedEnv) {
103
+ if (v === undefined) delete process.env[k];
104
+ else process.env[k] = v;
105
+ }
106
+ });
107
+
108
+ describe("hubConnected (#11456 D3)", () => {
109
+ it("is true only with CONTENT_ADAPTER=database and a spoke key on the wire", () => {
110
+ expect(hubConnected()).toBe(false);
111
+ hubConnect();
112
+ expect(hubConnected()).toBe(true);
113
+ delete process.env.AILK_SPOKE_KEY;
114
+ expect(hubConnected()).toBe(false);
115
+ hubConnect();
116
+ delete process.env.CONTENT_ADAPTER;
117
+ expect(hubConnected()).toBe(false);
118
+ });
119
+ });
120
+
121
+ describe("readHubSite (#11456 D3, AC-3)", () => {
122
+ it.each([
123
+ ["no AILK_SPOKE_KEY", () => delete process.env.AILK_SPOKE_KEY],
124
+ ["CONTENT_ADAPTER unset", () => delete process.env.CONTENT_ADAPTER],
125
+ ])("with %s answers undefined and never calls the hub", async (_label, unset) => {
126
+ hubConnect();
127
+ unset();
128
+ await expect(readHubSite()).resolves.toBeUndefined();
129
+ expect(mockGet).not.toHaveBeenCalled();
130
+ expect(mockUnstableCache).not.toHaveBeenCalled();
131
+ });
132
+
133
+ it("wraps the read with tags [siteConfigTag()] and revalidate 300, keyed by a digest of the key, never the key", async () => {
134
+ hubConnect();
135
+ mockGet.mockResolvedValue(ok({ identity: HUB_IDENTITY, seo: HUB_SEO }));
136
+
137
+ await expect(readHubSite()).resolves.toEqual({ identity: HUB_IDENTITY, seo: HUB_SEO });
138
+
139
+ expect(mockUnstableCache).toHaveBeenCalledTimes(1);
140
+ const [, keyParts, options] = mockUnstableCache.mock.calls[0]!;
141
+ expect(options).toEqual({ tags: [siteConfigTag()], revalidate: 300 });
142
+ expect(HUB_SITE_REVALIDATE_SECONDS).toBe(300);
143
+ expect(keyParts[0]).toBe("ailk-hub-site-config");
144
+ expect(keyParts[1]).toBe("default");
145
+ expect(keyParts[2]).toMatch(/^[0-9a-f]{16}$/);
146
+ expect(keyParts.join("|")).not.toContain(KEY);
147
+ });
148
+
149
+ it("two different keys never share an entry", async () => {
150
+ hubConnect();
151
+ mockGet.mockResolvedValue(ok({ identity: HUB_IDENTITY, seo: null }));
152
+ await readHubSite();
153
+ process.env.AILK_SPOKE_KEY = `${KEY.slice(0, -1)}y`;
154
+ await readHubSite();
155
+ const [a, b] = mockUnstableCache.mock.calls.map((call) => call[1].join("|"));
156
+ expect(a).not.toBe(b);
157
+ });
158
+
159
+ it("re-parses each row; a row its schema refuses is null", async () => {
160
+ hubConnect();
161
+ mockGet.mockResolvedValue(
162
+ ok({ identity: { kind: "Organization", name: "" }, seo: { version: "1", robots: { index: "no" } } }),
163
+ );
164
+ await expect(readHubSite()).resolves.toEqual({ identity: null, seo: null });
165
+ });
166
+
167
+ it.each([
168
+ ["a non-2xx", () => mockGet.mockResolvedValue({ ok: false, status: 401, body: {} })],
169
+ ["a throw", () => mockGet.mockRejectedValue(new TypeError("fetch failed"))],
170
+ ["a body without the two keys", () => mockGet.mockResolvedValue(ok({ identity: HUB_IDENTITY }))],
171
+ ])("%s writes nothing, serves the last good value and never rejects", async (_label, fail) => {
172
+ hubConnect();
173
+ // Cold instance, nothing cached: a failure answers undefined.
174
+ fail();
175
+ await expect(readHubSite()).resolves.toBeUndefined();
176
+ expect(mockCacheStore.size).toBe(0);
177
+
178
+ // One good read, then the failure again: the entry and the held value stand.
179
+ mockGet.mockReset().mockResolvedValue(ok({ identity: HUB_IDENTITY, seo: HUB_SEO }));
180
+ await readHubSite();
181
+ const [entry] = [...mockCacheStore.values()];
182
+ mockGet.mockReset();
183
+ fail();
184
+ mockCacheStore.clear(); // a purged tag: the next read misses
185
+ await expect(readHubSite()).resolves.toEqual(entry);
186
+ expect(mockCacheStore.size).toBe(0);
187
+ });
188
+
189
+ it("a read slower than 3 s is a failed read", async () => {
190
+ jest.useFakeTimers();
191
+ hubConnect();
192
+ mockGet.mockReturnValue(new Promise(() => undefined));
193
+ const read = readHubSite();
194
+ await jest.advanceTimersByTimeAsync(HUB_SITE_TIMEOUT_MS);
195
+ await expect(read).resolves.toBeUndefined();
196
+ expect(mockCacheStore.size).toBe(0);
197
+ });
198
+ });
199
+
200
+ describe("the contact email from the held hub value (#11456 D4, AC-2)", () => {
201
+ it("answers the file value on a cold instance, then the hub email after one resolved read", async () => {
202
+ hubConnect();
203
+ expect(heldHubSite()).toBeUndefined();
204
+ expect(readSiteContactEmail()).toBe("file@file.example");
205
+
206
+ mockGet.mockResolvedValue(ok({ identity: HUB_IDENTITY, seo: null }));
207
+ await readHubSite();
208
+
209
+ expect(readSiteContactEmail()).toBe("hub@hub.example");
210
+ });
211
+
212
+ it("a hub identity with no email falls back to the file's top-level contactEmail", async () => {
213
+ hubConnect();
214
+ const { email: _email, ...noEmail } = HUB_IDENTITY;
215
+ mockGet.mockResolvedValue(ok({ identity: noEmail, seo: null }));
216
+ await readHubSite();
217
+ expect(readSiteContactEmail()).toBe("file@file.example");
218
+ });
219
+
220
+ it.each([
221
+ ["has no frontmatter", "No frontmatter here.\n"],
222
+ ["has empty frontmatter", "---\n---\n"],
223
+ ])("answers the hub email when _site.mdx %s", async (_label, body) => {
224
+ hubConnect();
225
+ writeFileSync(join(root, "_site.mdx"), body);
226
+ mockGet.mockResolvedValue(ok({ identity: HUB_IDENTITY, seo: null }));
227
+ await readHubSite();
228
+ expect(readSiteContactEmail()).toBe("hub@hub.example");
229
+ });
230
+
231
+ it("a site that is not hub-connected never reads a held value", async () => {
232
+ hubConnect();
233
+ mockGet.mockResolvedValue(ok({ identity: HUB_IDENTITY, seo: null }));
234
+ await readHubSite();
235
+ delete process.env.AILK_SPOKE_KEY;
236
+ expect(heldHubSite()).toBeUndefined();
237
+ expect(readSiteContactEmail()).toBe("file@file.example");
238
+ });
239
+ });
@@ -15,7 +15,7 @@
15
15
  export {};
16
16
 
17
17
  // eslint-disable-next-line no-restricted-syntax -- test-seam mock: a "use server" boundary the module only binds
18
- jest.mock("../../app/[locale]/contact/contact.actions", () => ({
18
+ jest.mock("@working-theory/site-pages/pages/contact/contact.actions", () => ({
19
19
  captureLeadAction: jest.fn(),
20
20
  }));
21
21
  // eslint-disable-next-line no-restricted-syntax -- test-seam mock: a "use server" boundary the module only binds
@@ -18,7 +18,7 @@ jest.mock("@working-theory/api-client", () => ({
18
18
  }));
19
19
 
20
20
  // eslint-disable-next-line no-restricted-syntax -- test-seam mock: a "use server" boundary the module only binds
21
- jest.mock("../../app/[locale]/contact/contact.actions", () => ({
21
+ jest.mock("@working-theory/site-pages/pages/contact/contact.actions", () => ({
22
22
  captureLeadAction: jest.fn(),
23
23
  }));
24
24
  // eslint-disable-next-line no-restricted-syntax -- test-seam mock: a "use server" boundary the module only binds
@@ -28,7 +28,7 @@ jest.mock("../newsletter.actions", () => ({
28
28
 
29
29
  import { flows } from "@working-theory/api-client";
30
30
 
31
- import { captureLeadAction } from "../../app/[locale]/contact/contact.actions";
31
+ import { captureLeadAction } from "@working-theory/site-pages/pages/contact/contact.actions";
32
32
  import {
33
33
  fillEndingName,
34
34
  framedSources,
@@ -14,7 +14,7 @@ import {
14
14
  pricingPageCard,
15
15
  pricingSections,
16
16
  } from "../pricing-page";
17
- import type { DetailPage } from "../route-family";
17
+ import type { DetailPage } from "@working-theory/site-pages/lib/route-family";
18
18
 
19
19
  const fetchMock: jest.Mock = jest.fn(async () => ({
20
20
  ok: true,
@@ -13,6 +13,7 @@
13
13
  import { deckReturnHref } from "@working-theory/ui/chrome";
14
14
 
15
15
  import {
16
+ ancestorPaths,
16
17
  backLinkHref,
17
18
  backLinkName,
18
19
  navLabelsByPath,
@@ -87,6 +88,17 @@ describe("backLinkHref — the served parent", () => {
87
88
  });
88
89
  });
89
90
 
91
+ describe("ancestorPaths — the parents the walk asks about (#11438)", () => {
92
+ it("lists the bare ancestors below the home, nearest first, locale prefix dropped", () => {
93
+ expect(ancestorPaths("/es/flows/audit/start?x=1", LOCALES)).toEqual(["/flows/audit", "/flows"]);
94
+ });
95
+
96
+ it("has none for a top-level page or an absent pathname", () => {
97
+ expect(ancestorPaths("/about", LOCALES)).toEqual([]);
98
+ expect(ancestorPaths(null, LOCALES)).toEqual([]);
99
+ });
100
+ });
101
+
90
102
  describe("backLinkName — the destination named in the label", () => {
91
103
  const titles = new Map([
92
104
  ["/meet", "Book a meeting with Sam"],
@@ -109,6 +121,52 @@ describe("backLinkName — the destination named in the label", () => {
109
121
  "Case studies",
110
122
  );
111
123
  });
124
+
125
+ describe("a title carrying the site name as a suffix", () => {
126
+ const siteName = "Sam Henry";
127
+ const suffixed = new Map([
128
+ ["/about", "About — Sam Henry"],
129
+ ["/faq", "Questions about hiring Sam | Sam Henry"],
130
+ ["/work", "Work - Sam Henry"],
131
+ ["/blog/ai-builder-principles", "The AI Builder Principles"],
132
+ ["/notes", "Sam Henry — Notes from the field"],
133
+ ["/press", "Working with Sam Henry and the team"],
134
+ ["/only", " — Sam Henry"],
135
+ ]);
136
+ const name = (parent: string, navLabels = new Map<string, string>()): string =>
137
+ backLinkName(parent, { navLabels, titles: suffixed, siteName });
138
+
139
+ it.each([
140
+ ["/about", "About"],
141
+ ["/faq", "Questions about hiring Sam"],
142
+ ["/work", "Work"],
143
+ ])("strips the trailing suffix: %s → %s", (parent, expected) => {
144
+ expect(name(parent)).toBe(expected);
145
+ });
146
+
147
+ it("leaves a title without the suffix unchanged", () => {
148
+ expect(name("/blog/ai-builder-principles")).toBe("The AI Builder Principles");
149
+ });
150
+
151
+ it("leaves the site name anywhere but the trailing suffix alone", () => {
152
+ expect(name("/notes")).toBe("Sam Henry — Notes from the field");
153
+ expect(name("/press")).toBe("Working with Sam Henry and the team");
154
+ });
155
+
156
+ it("prefers the nav label when the nav has one for the parent", () => {
157
+ expect(name("/about", new Map([["/about", "About me"]]))).toBe("About me");
158
+ });
159
+
160
+ it("keeps the title when stripping would leave nothing", () => {
161
+ expect(name("/only")).toBe(" — Sam Henry");
162
+ });
163
+
164
+ it("leaves the title whole when no site name is known", () => {
165
+ expect(backLinkName("/about", { navLabels: new Map(), titles: suffixed })).toBe(
166
+ "About — Sam Henry",
167
+ );
168
+ });
169
+ });
112
170
  });
113
171
 
114
172
  describe("navLabelsByPath", () => {
@@ -1,16 +1,20 @@
1
1
  /**
2
2
  * Tests for the served-pages source the bare back arrow walks up through
3
3
  * (operator handoff 2026-11-09): listed content pages with their titles,
4
- * fixed code-rendered routes of the modules this site carries, and a
5
- * fail-safe when the adapter throws.
4
+ * the page routes the app builds (#11438) — its page files and Next's
5
+ * app-path routes manifest, dynamic segments included — and a fail-safe when
6
+ * a source cannot be read.
7
+ *
8
+ * Every case builds its own app tree in a temporary directory and points
9
+ * `process.cwd()` at it, so the suite asserts the same thing in this
10
+ * monorepo and in any scaffold, whatever pages either carries.
6
11
  */
7
12
 
8
- // A module, not a script: its helpers stay out of the global scope.
9
- export {};
10
- // Whether this site carries the scheduling module is the site's own generated
11
- // flag, so the suite asserts against it: the monorepo serves /meet, a
12
- // scaffold without scheduling does not (release-check matrix rows, 2026-11-10).
13
- import { SCHEDULING_PAGES } from "../modules.generated";
13
+ import { mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from "node:fs";
14
+ import { tmpdir } from "node:os";
15
+ import { dirname, join } from "node:path";
16
+
17
+ import { ancestorPaths, servedParent } from "../profile-back-link";
14
18
 
15
19
  const mockListPages = jest.fn();
16
20
  let mockAdapterThrows = false;
@@ -27,15 +31,44 @@ function page(type: string, slug: string, title: string) {
27
31
  return { type, slug, title };
28
32
  }
29
33
 
30
- async function loadServed(locale: string) {
31
- let servedPages!: typeof import("../served-pages").servedPages;
34
+ let root: string;
35
+
36
+ /** Writes empty files under the temporary site root, at their relative paths. */
37
+ function site(files: Record<string, string>): void {
38
+ for (const [path, body] of Object.entries(files)) {
39
+ const file = join(root, path);
40
+ mkdirSync(dirname(file), { recursive: true });
41
+ writeFileSync(file, body);
42
+ }
43
+ }
44
+
45
+ /** An app tree of empty page files, each given relative to `app/[locale]/`. */
46
+ function appPages(...routes: string[]): void {
47
+ site(Object.fromEntries(routes.map((route) => [join("app/[locale]", route, "page.tsx"), ""])));
48
+ }
49
+
50
+ function loadModule(): typeof import("../served-pages") {
51
+ let mod!: typeof import("../served-pages");
32
52
  jest.isolateModules(() => {
33
- ({ servedPages } = jest.requireActual("../served-pages"));
53
+ mod = jest.requireActual("../served-pages");
34
54
  });
35
- return servedPages(locale);
55
+ return mod;
56
+ }
57
+
58
+ function loadServed(locale: string, candidates?: readonly string[]) {
59
+ return loadModule().servedPages(locale, candidates);
60
+ }
61
+
62
+ /** The arrow's parent for `pathname`, as the locale layout asks it. */
63
+ async function arrowParent(pathname: string): Promise<string | null> {
64
+ const locales = ["en"];
65
+ const pages = await loadServed("en", ancestorPaths(pathname, locales));
66
+ return servedParent({ pathname, locales, served: (path) => pages.has(path) });
36
67
  }
37
68
 
38
69
  beforeEach(() => {
70
+ root = mkdtempSync(join(tmpdir(), "served-pages-"));
71
+ jest.spyOn(process, "cwd").mockReturnValue(root);
39
72
  mockAdapterThrows = false;
40
73
  mockListPages.mockReset();
41
74
  mockListPages.mockImplementation((type: string) => {
@@ -47,7 +80,12 @@ beforeEach(() => {
47
80
  });
48
81
  });
49
82
 
50
- describe("servedPages", () => {
83
+ afterEach(() => {
84
+ jest.restoreAllMocks();
85
+ rmSync(root, { recursive: true, force: true });
86
+ });
87
+
88
+ describe("servedPages — content pages", () => {
51
89
  it("lists a content page at its served path with its title", async () => {
52
90
  const pages = await loadServed("en");
53
91
  expect(pages.get("/about")).toBe("About us");
@@ -58,20 +96,125 @@ describe("servedPages", () => {
58
96
  expect([...pages.values()]).not.toContain("Thanks");
59
97
  });
60
98
 
61
- it("includes /meet, the scheduling module's code-rendered index, with no title", async () => {
62
- const pages = await loadServed("en");
63
- expect(pages.get("/meet")).toBe(SCHEDULING_PAGES ? "" : undefined);
64
- });
65
-
66
99
  it("reads the locale it is asked for", async () => {
67
100
  await loadServed("es");
68
101
  expect(mockListPages).toHaveBeenCalledWith("AboutPage", "es");
69
102
  });
70
103
 
71
- it("keeps the code-rendered routes when the adapter throws", async () => {
104
+ it("keeps a content page's title where the app also builds its route", async () => {
105
+ appPages("about");
106
+ const pages = await loadServed("en");
107
+ expect(pages.get("/about")).toBe("About us");
108
+ });
109
+ });
110
+
111
+ describe("servedPages — the page routes the app builds (#11438)", () => {
112
+ // The fixture site has no package.json and no generated module flag, so
113
+ // /meet is served by its page file alone (samhenry.org's own /meet pages).
114
+ it("serves /meet from the app's own page file, with no scheduling package and no title", async () => {
115
+ appPages("meet", "meet/[slug]");
116
+ const pages = await loadServed("en");
117
+ expect(pages.get("/meet")).toBe("");
118
+ await expect(arrowParent("/meet/intro")).resolves.toBe("/meet");
119
+ });
120
+
121
+ it.each([
122
+ ["/private/meet-up", "/private", ["private"]],
123
+ ["/diagnostic/start", "/diagnostic", ["diagnostic", "diagnostic/start"]],
124
+ ["/flows/audit/start", "/flows/audit", ["flows/[slug]", "flows/[slug]/start"]],
125
+ ["/es/flows/audit/start", "/flows/audit", ["flows/[slug]", "flows/[slug]/start"]],
126
+ ])("%s → %s, a page route the app builds", async (pathname, parent, routes) => {
127
+ appPages(...routes);
128
+ const locales = ["en", "es"];
129
+ const pages = await loadServed("en", ancestorPaths(pathname, locales));
130
+ expect(servedParent({ pathname, locales, served: (path) => pages.has(path) })).toBe(parent);
131
+ });
132
+
133
+ it("reads Next's app-path routes manifest where the page files are not deployed", async () => {
134
+ site({
135
+ ".next/app-path-routes-manifest.json": JSON.stringify({
136
+ "/[locale]/diagnostic/page": "/[locale]/diagnostic",
137
+ "/[locale]/flows/[slug]/page": "/[locale]/flows/[slug]",
138
+ "/[locale]/feed.xml/route": "/[locale]/feed.xml",
139
+ "/_not-found/page": "/_not-found",
140
+ }),
141
+ });
142
+ await expect(arrowParent("/diagnostic/start")).resolves.toBe("/diagnostic");
143
+ await expect(arrowParent("/flows/audit/start")).resolves.toBe("/flows/audit");
144
+ const pages = await loadServed("en");
145
+ expect(pages.has("/feed.xml")).toBe(false);
146
+ expect(pages.has("/_not-found")).toBe(false);
147
+ });
148
+
149
+ it("drops route groups and skips private folders", async () => {
150
+ appPages("(authed)/account", "_parts/hidden");
151
+ const pages = await loadServed("en");
152
+ expect(pages.get("/account")).toBe("");
153
+ expect(pages.has("/_parts/hidden")).toBe(false);
154
+ expect(pages.has("/hidden")).toBe(false);
155
+ });
156
+
157
+ it("serves an optional catch-all's own index, never a path under it", async () => {
158
+ appPages("blog/[[...slug]]");
159
+ const pages = await loadServed("en", ["/blog/series"]);
160
+ expect(pages.get("/blog")).toBe("");
161
+ expect(pages.has("/blog/series")).toBe(false);
162
+ });
163
+
164
+ it("adds a dynamic route's match only for the candidates asked about, never to the shared set", async () => {
165
+ appPages("flows/[slug]");
166
+ const mod = loadModule();
167
+ expect((await mod.servedPages("en", ["/flows/audit"])).has("/flows/audit")).toBe(true);
168
+ expect((await mod.servedPages("en")).has("/flows/audit")).toBe(false);
169
+ });
170
+
171
+ it("names no route in its own source", () => {
172
+ // The code alone: its doc comments name routes as examples.
173
+ const source = readFileSync(join(__dirname, "..", "served-pages.ts"), "utf8")
174
+ .replace(/\/\*[\s\S]*?\*\//g, "")
175
+ .replace(/^\s*\/\/.*$/gm, "");
176
+ for (const route of ["meet", "private", "diagnostic", "flows"]) {
177
+ expect(source).not.toMatch(new RegExp(`["'\`]/${route}\\b`));
178
+ }
179
+ });
180
+ });
181
+
182
+ describe("servedPages — what still falls through", () => {
183
+ it("walks past a parent with no built page route and no content page, then home", async () => {
184
+ appPages("meet");
185
+ await expect(arrowParent("/meet/nothing/deeper")).resolves.toBe("/meet");
186
+ await expect(arrowParent("/nowhere/at-all")).resolves.toBeNull();
187
+ });
188
+
189
+ it("never counts the site's all-dynamic content catch-all as a parent", async () => {
190
+ appPages("[slug]", "[slug]/[detail]");
191
+ await expect(arrowParent("/widgets/one/two")).resolves.toBeNull();
192
+ });
193
+
194
+ it("never counts a required catch-all as a parent", async () => {
195
+ appPages("files/[...path]");
196
+ await expect(arrowParent("/files/a/b")).resolves.toBeNull();
197
+ });
198
+
199
+ it("counts a built route with seed content only through its content page", async () => {
200
+ appPages("faq");
201
+ const pages = await loadServed("en");
202
+ expect(pages.has("/faq")).toBe(false);
203
+ });
204
+
205
+ it("keeps the built routes when the adapter throws", async () => {
206
+ appPages("meet");
72
207
  mockAdapterThrows = true;
73
208
  const pages = await loadServed("en");
74
- expect(pages.has("/meet")).toBe(SCHEDULING_PAGES);
209
+ expect(pages.has("/meet")).toBe(true);
75
210
  expect(pages.has("/about")).toBe(false);
76
211
  });
212
+
213
+ it("serves only content pages, and warns, when neither the page files nor the manifest can be read", async () => {
214
+ site({ ".next/app-path-routes-manifest.json": "not json" });
215
+ const warn = jest.spyOn(console, "warn").mockImplementation(() => {});
216
+ const pages = await loadServed("en", ["/flows/audit"]);
217
+ expect([...pages.keys()]).toEqual(["/about"]);
218
+ expect(warn).toHaveBeenCalledWith(expect.stringContaining("[served-pages]"));
219
+ });
77
220
  });
@@ -290,3 +290,80 @@ describe("siteLogo() — brand.logomark (#6820)", () => {
290
290
  expect(() => siteLogo()).toThrow(/alt/);
291
291
  });
292
292
  });
293
+
294
+ // #11456 D4 — the async brand. The hub read is doubled at its own module
295
+ // (`readHubSite`, whose HTTP and cache edges `hub-site-config.test.ts` pins).
296
+ describe("resolveSiteBrand() (#11456 D4)", () => {
297
+ const mockReadHubSite = jest.fn();
298
+ beforeEach(() => {
299
+ process.env.AILK_CONTENT_ROOT = tmpRoot;
300
+ delete process.env.NEXT_PUBLIC_SITE_NAME;
301
+ writeSiteMdx(tmpRoot, { siteName: "File Site", baseUrl: "https://file.example" });
302
+ mockReadHubSite.mockReset();
303
+ // The hub read is the HTTP boundary; its own suite pins it.
304
+ jest.doMock("../hub-site-config", () => ({ readHubSite: () => mockReadHubSite() }));
305
+ });
306
+ afterEach(() => {
307
+ jest.dontMock("../hub-site-config");
308
+ });
309
+
310
+ const hub = (identity: unknown, seo: unknown = null) =>
311
+ mockReadHubSite.mockResolvedValue({ identity, seo });
312
+
313
+ it("with no hub site, answers the module's constants and indexable", async () => {
314
+ mockReadHubSite.mockResolvedValue(undefined);
315
+ const brand = await loadSiteBrand();
316
+ await expect(brand.resolveSiteBrand()).resolves.toEqual({
317
+ siteName: brand.SITE_NAME,
318
+ description: brand.SITE_DESCRIPTION,
319
+ copyrightHolder: brand.COPYRIGHT_HOLDER,
320
+ indexable: true,
321
+ });
322
+ });
323
+
324
+ it("a hub identity with no description takes the seo row's, never the file's", async () => {
325
+ hub(
326
+ { kind: "Organization", name: "Hub Co", url: "https://hub.example" },
327
+ { version: "1", description: "Seo description." },
328
+ );
329
+ const { resolveSiteBrand } = await loadSiteBrand();
330
+ await expect(resolveSiteBrand()).resolves.toEqual({
331
+ siteName: "Hub Co",
332
+ description: "Seo description.",
333
+ copyrightHolder: "Hub Co",
334
+ indexable: true,
335
+ });
336
+ });
337
+
338
+ it("collapses control and line-separator runs in hub values to one space", async () => {
339
+ hub({
340
+ kind: "Organization",
341
+ name: "A\n\u2028\u202eB\u200b",
342
+ legalName: "Legal\r\nCo",
343
+ description: "Line\tone\u2029two",
344
+ url: "https://hub.example",
345
+ });
346
+ const { resolveSiteBrand } = await loadSiteBrand();
347
+ await expect(resolveSiteBrand()).resolves.toMatchObject({
348
+ siteName: "A B",
349
+ copyrightHolder: "Legal Co",
350
+ description: "Line one two",
351
+ });
352
+ });
353
+
354
+ it("NEXT_PUBLIC_SITE_NAME still wins the hub name", async () => {
355
+ process.env.NEXT_PUBLIC_SITE_NAME = "Env Name";
356
+ hub({ kind: "Organization", name: "Hub Co", url: "https://hub.example" });
357
+ const { resolveSiteBrand } = await loadSiteBrand();
358
+ await expect(resolveSiteBrand()).resolves.toMatchObject({ siteName: "Env Name" });
359
+ });
360
+
361
+ it("indexable reads the seo row even with no identity row", async () => {
362
+ hub(null, { version: "1", robots: { index: false } });
363
+ const brand = await loadSiteBrand();
364
+ await expect(brand.resolveSiteBrand()).resolves.toMatchObject({
365
+ siteName: brand.SITE_NAME,
366
+ indexable: false,
367
+ });
368
+ });
369
+ });