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.
- package/component-catalog.json +1 -1
- package/component-catalog.md +1 -1
- package/dist/add-route.js +15 -0
- package/dist/body-heading.d.ts +2 -1
- package/dist/body-heading.js +31 -3
- package/dist/module-architecture.js +0 -3
- package/dist/remove-module.js +13 -4
- package/dist/routes.d.ts +7 -0
- package/dist/routes.js +1 -1
- package/dist/site-roster.js +7 -1
- package/dist/surfaces.d.ts +2 -0
- package/dist/surfaces.js +59 -172
- package/package.json +3 -3
- package/templates/apps/web/CLAUDE.md +19 -2
- package/templates/apps/web/__tests__/__mocks__/next-intl-server.ts +3 -2
- package/templates/apps/web/__tests__/__mocks__/next-intl.ts +3 -2
- package/templates/apps/web/app/[locale]/layout.tsx +42 -25
- package/templates/apps/web/app/api/revalidate/__tests__/route.test.ts +56 -1
- package/templates/apps/web/app/api/revalidate/route.ts +45 -4
- package/templates/apps/web/app/llms.txt/__tests__/site-listing.test.ts +53 -0
- package/templates/apps/web/app/llms.txt/route.ts +5 -2
- package/templates/apps/web/i18n/request.ts +5 -1
- package/templates/apps/web/jest.config.cjs +6 -0
- package/templates/apps/web/lib/__tests__/deck-page.test.ts +9 -0
- package/templates/apps/web/lib/__tests__/hub-site-config.test.ts +239 -0
- package/templates/apps/web/lib/__tests__/in-page-magnet-self-request.test.ts +1 -1
- package/templates/apps/web/lib/__tests__/in-page-magnet.test.ts +2 -2
- package/templates/apps/web/lib/__tests__/pricing-page.test.ts +1 -1
- package/templates/apps/web/lib/__tests__/profile-back-link.test.ts +58 -0
- package/templates/apps/web/lib/__tests__/served-pages.test.ts +163 -20
- package/templates/apps/web/lib/__tests__/site-brand.test.ts +77 -0
- package/templates/apps/web/{app/[locale]/contact → lib}/__tests__/site-contact-lines.test.ts +64 -0
- package/templates/apps/web/lib/__tests__/site-identity-feature-list.test.ts +115 -3
- package/templates/apps/web/lib/__tests__/structured-data.test.tsx +17 -4
- package/templates/apps/web/lib/hub-site-config.ts +151 -0
- package/templates/apps/web/lib/in-page-magnet.ts +2 -2
- package/templates/apps/web/lib/pricing-page.ts +3 -3
- package/templates/apps/web/lib/profile-back-link.ts +49 -12
- package/templates/apps/web/lib/served-pages.ts +144 -39
- package/templates/apps/web/lib/site-brand.tsx +66 -0
- package/templates/apps/web/{app/[locale]/contact → lib}/site-contact-email.ts +25 -5
- package/templates/apps/web/{app/[locale]/contact → lib}/site-contact-lines.ts +21 -5
- package/templates/apps/web/lib/site-header.ts +1 -1
- package/templates/apps/web/lib/site-identity.ts +38 -2
- package/templates/apps/web/messages/en.json +3 -119
- package/templates/apps/web/next.config.mjs +7 -0
- package/templates/apps/web/package.json +1 -0
- package/templates/apps/web/site-pages.config.tsx +85 -0
- package/templates/tools/body-heading.ts +30 -3
- package/versions.json +50 -49
- package/templates/apps/web/app/[locale]/(authed)/leads/__tests__/page.test.tsx +0 -205
- package/templates/apps/web/app/[locale]/(authed)/leads/components/LeadsTable.tsx +0 -137
- package/templates/apps/web/app/[locale]/(authed)/leads/page.tsx +0 -122
- package/templates/apps/web/app/[locale]/(authed)/waitlist/components/ForbiddenState.tsx +0 -24
- package/templates/apps/web/app/[locale]/(authed)/waitlist/format.ts +0 -111
- package/templates/apps/web/app/[locale]/[slug]/[detail]/__tests__/page.test.tsx +0 -402
- package/templates/apps/web/app/[locale]/[slug]/[detail]/page.tsx +0 -143
- package/templates/apps/web/app/[locale]/[slug]/__tests__/page.test.tsx +0 -148
- package/templates/apps/web/app/[locale]/[slug]/page.tsx +0 -109
- package/templates/apps/web/app/[locale]/about/[slug]/page.tsx +0 -46
- package/templates/apps/web/app/[locale]/about/__tests__/about-routes.test.tsx +0 -353
- package/templates/apps/web/app/[locale]/about/page.tsx +0 -122
- package/templates/apps/web/app/[locale]/alternatives/__tests__/page.test.tsx +0 -161
- package/templates/apps/web/app/[locale]/alternatives/page.tsx +0 -112
- package/templates/apps/web/app/[locale]/careers/[slug]/[action]/page.tsx +0 -244
- package/templates/apps/web/app/[locale]/careers/[slug]/apply.actions.ts +0 -325
- package/templates/apps/web/app/[locale]/careers/[slug]/job-application-form.ts +0 -120
- package/templates/apps/web/app/[locale]/careers/[slug]/page.tsx +0 -73
- package/templates/apps/web/app/[locale]/careers/__tests__/apply.actions.test.ts +0 -497
- package/templates/apps/web/app/[locale]/careers/__tests__/careers-hub.test.tsx +0 -172
- package/templates/apps/web/app/[locale]/careers/__tests__/careers-set.test.tsx +0 -153
- package/templates/apps/web/app/[locale]/careers/__tests__/job-application-form.test.ts +0 -141
- package/templates/apps/web/app/[locale]/careers/__tests__/job-apply-page.test.tsx +0 -546
- package/templates/apps/web/app/[locale]/careers/__tests__/page-renderer-migration.test.tsx +0 -189
- package/templates/apps/web/app/[locale]/careers/page.tsx +0 -165
- package/templates/apps/web/app/[locale]/case-studies/[slug]/page.tsx +0 -49
- package/templates/apps/web/app/[locale]/case-studies/__tests__/hub-children.test.tsx +0 -65
- package/templates/apps/web/app/[locale]/case-studies/__tests__/page-renderer-migration.test.tsx +0 -125
- package/templates/apps/web/app/[locale]/case-studies/page.tsx +0 -49
- package/templates/apps/web/app/[locale]/clients/__tests__/page-renderer-migration.test.tsx +0 -85
- package/templates/apps/web/app/[locale]/clients/page.tsx +0 -47
- package/templates/apps/web/app/[locale]/contact/ConversationalIntakeWrapper.tsx +0 -249
- package/templates/apps/web/app/[locale]/contact/__tests__/ConversationalIntakeWrapper.test.tsx +0 -400
- package/templates/apps/web/app/[locale]/contact/__tests__/contact-form-magnet.test.ts +0 -138
- package/templates/apps/web/app/[locale]/contact/__tests__/contact-form-text.test.ts +0 -49
- package/templates/apps/web/app/[locale]/contact/__tests__/contact-magnet-page.test.tsx +0 -494
- package/templates/apps/web/app/[locale]/contact/__tests__/contact.actions.test.ts +0 -1122
- package/templates/apps/web/app/[locale]/contact/__tests__/intake-analytics.test.ts +0 -51
- package/templates/apps/web/app/[locale]/contact/__tests__/page-renderer-migration.test.tsx +0 -319
- package/templates/apps/web/app/[locale]/contact/contact-form-magnet.ts +0 -77
- package/templates/apps/web/app/[locale]/contact/contact-form-text.ts +0 -52
- package/templates/apps/web/app/[locale]/contact/contact.actions.ts +0 -403
- package/templates/apps/web/app/[locale]/contact/intake-analytics.ts +0 -49
- package/templates/apps/web/app/[locale]/contact/intake-script.ts +0 -92
- package/templates/apps/web/app/[locale]/contact/page.tsx +0 -267
- package/templates/apps/web/app/[locale]/courses/[slug]/page.tsx +0 -50
- package/templates/apps/web/app/[locale]/courses/__tests__/hub-children.test.tsx +0 -32
- package/templates/apps/web/app/[locale]/courses/__tests__/page-renderer-migration.test.tsx +0 -123
- package/templates/apps/web/app/[locale]/courses/page.tsx +0 -49
- package/templates/apps/web/app/[locale]/events/[slug]/page.tsx +0 -57
- package/templates/apps/web/app/[locale]/events/__tests__/hub-children.test.tsx +0 -32
- package/templates/apps/web/app/[locale]/events/__tests__/page-renderer-migration.test.tsx +0 -164
- package/templates/apps/web/app/[locale]/events/__tests__/program-event.test.tsx +0 -120
- package/templates/apps/web/app/[locale]/events/page.tsx +0 -60
- package/templates/apps/web/app/[locale]/faq/page.tsx +0 -54
- package/templates/apps/web/app/[locale]/features/[slug]/page.tsx +0 -54
- package/templates/apps/web/app/[locale]/features/__tests__/hub-children.test.tsx +0 -32
- package/templates/apps/web/app/[locale]/features/page.tsx +0 -50
- package/templates/apps/web/app/[locale]/for/[slug]/page.tsx +0 -54
- package/templates/apps/web/app/[locale]/for/__tests__/hub-children.test.tsx +0 -32
- package/templates/apps/web/app/[locale]/for/__tests__/page-renderer-migration.test.tsx +0 -90
- package/templates/apps/web/app/[locale]/for/page.tsx +0 -51
- package/templates/apps/web/app/[locale]/glossary/page.tsx +0 -53
- package/templates/apps/web/app/[locale]/how-to/[slug]/page.tsx +0 -50
- package/templates/apps/web/app/[locale]/how-to/__tests__/page-renderer-migration.test.tsx +0 -78
- package/templates/apps/web/app/[locale]/how-to/page.tsx +0 -50
- package/templates/apps/web/app/[locale]/integrations/[slug]/page.tsx +0 -54
- package/templates/apps/web/app/[locale]/integrations/__tests__/hub-children.test.tsx +0 -38
- package/templates/apps/web/app/[locale]/integrations/__tests__/page-renderer-migration.test.tsx +0 -141
- package/templates/apps/web/app/[locale]/integrations/page.tsx +0 -49
- package/templates/apps/web/app/[locale]/launch-service/page.tsx +0 -44
- package/templates/apps/web/app/[locale]/newsletter/__tests__/page.test.tsx +0 -236
- package/templates/apps/web/app/[locale]/newsletter/page.tsx +0 -179
- package/templates/apps/web/app/[locale]/page.tsx +0 -147
- package/templates/apps/web/app/[locale]/partners/[slug]/page.tsx +0 -45
- package/templates/apps/web/app/[locale]/partners/__tests__/hub-children.test.tsx +0 -32
- package/templates/apps/web/app/[locale]/partners/__tests__/page-renderer-migration.test.tsx +0 -125
- package/templates/apps/web/app/[locale]/partners/page.tsx +0 -49
- package/templates/apps/web/app/[locale]/portfolio/[slug]/page.tsx +0 -46
- package/templates/apps/web/app/[locale]/portfolio/__tests__/hub-children.test.tsx +0 -38
- package/templates/apps/web/app/[locale]/portfolio/page.tsx +0 -50
- package/templates/apps/web/app/[locale]/pricing/[slug]/__tests__/page.test.tsx +0 -324
- package/templates/apps/web/app/[locale]/pricing/[slug]/page.tsx +0 -87
- package/templates/apps/web/app/[locale]/pricing/__tests__/__snapshots__/unconnected.test.tsx.snap +0 -7
- package/templates/apps/web/app/[locale]/pricing/__tests__/offerings.test.tsx +0 -605
- package/templates/apps/web/app/[locale]/pricing/__tests__/page.test.tsx +0 -219
- package/templates/apps/web/app/[locale]/pricing/__tests__/pricing-pages.test.tsx +0 -215
- package/templates/apps/web/app/[locale]/pricing/__tests__/unconnected.test.tsx +0 -282
- package/templates/apps/web/app/[locale]/pricing/page.tsx +0 -120
- package/templates/apps/web/app/[locale]/privacy/page.tsx +0 -40
- package/templates/apps/web/app/[locale]/products/[slug]/page.tsx +0 -50
- package/templates/apps/web/app/[locale]/products/__tests__/hub-children.test.tsx +0 -32
- package/templates/apps/web/app/[locale]/products/__tests__/page-renderer-migration.test.tsx +0 -141
- package/templates/apps/web/app/[locale]/products/page.tsx +0 -49
- package/templates/apps/web/app/[locale]/projects/[slug]/page.tsx +0 -37
- package/templates/apps/web/app/[locale]/projects/__tests__/hub-children.test.tsx +0 -32
- package/templates/apps/web/app/[locale]/projects/__tests__/page-renderer-migration.test.tsx +0 -157
- package/templates/apps/web/app/[locale]/projects/page.tsx +0 -49
- package/templates/apps/web/app/[locale]/purchase-policy/page.tsx +0 -49
- package/templates/apps/web/app/[locale]/resources/[slug]/page.tsx +0 -54
- package/templates/apps/web/app/[locale]/resources/__tests__/hub-children.test.tsx +0 -38
- package/templates/apps/web/app/[locale]/resources/__tests__/page-renderer-migration.test.tsx +0 -151
- package/templates/apps/web/app/[locale]/resources/page.tsx +0 -49
- package/templates/apps/web/app/[locale]/services/[slug]/[child]/page.tsx +0 -68
- package/templates/apps/web/app/[locale]/services/[slug]/page.tsx +0 -88
- package/templates/apps/web/app/[locale]/services/__tests__/hub-children.test.tsx +0 -158
- package/templates/apps/web/app/[locale]/services/__tests__/page-renderer-migration.test.tsx +0 -187
- package/templates/apps/web/app/[locale]/services/__tests__/service-detail-sections.test.tsx +0 -224
- package/templates/apps/web/app/[locale]/services/__tests__/service-families.test.tsx +0 -368
- package/templates/apps/web/app/[locale]/services/page.tsx +0 -71
- package/templates/apps/web/app/[locale]/software/[slug]/page.tsx +0 -49
- package/templates/apps/web/app/[locale]/software/__tests__/page-renderer-migration.test.tsx +0 -81
- package/templates/apps/web/app/[locale]/software/page.tsx +0 -49
- package/templates/apps/web/app/[locale]/team/[slug]/page.tsx +0 -45
- package/templates/apps/web/app/[locale]/team/__tests__/hub-children.test.tsx +0 -32
- package/templates/apps/web/app/[locale]/team/__tests__/team-routes.test.tsx +0 -161
- package/templates/apps/web/app/[locale]/team/page.tsx +0 -50
- package/templates/apps/web/app/[locale]/tech-articles/[slug]/page.tsx +0 -54
- package/templates/apps/web/app/[locale]/tech-articles/__tests__/page-renderer-migration.test.tsx +0 -82
- package/templates/apps/web/app/[locale]/tech-articles/page.tsx +0 -49
- package/templates/apps/web/app/[locale]/templates/[slug]/__tests__/page.test.tsx +0 -203
- package/templates/apps/web/app/[locale]/templates/[slug]/page.tsx +0 -81
- package/templates/apps/web/app/[locale]/templates/__tests__/page.test.tsx +0 -237
- package/templates/apps/web/app/[locale]/templates/page.tsx +0 -114
- package/templates/apps/web/app/[locale]/terms/page.tsx +0 -40
- package/templates/apps/web/app/[locale]/testimonials/__tests__/page-renderer-migration.test.tsx +0 -85
- package/templates/apps/web/app/[locale]/testimonials/page.tsx +0 -51
- package/templates/apps/web/app/[locale]/thanks/[slug]/__tests__/page.test.tsx +0 -136
- package/templates/apps/web/app/[locale]/thanks/[slug]/page.tsx +0 -39
- package/templates/apps/web/app/[locale]/unsubscribe/__tests__/unsubscribe-rsc-boundary.test.tsx +0 -226
- package/templates/apps/web/app/[locale]/unsubscribe/__tests__/unsubscribe.test.tsx +0 -217
- package/templates/apps/web/app/[locale]/unsubscribe/page.tsx +0 -106
- package/templates/apps/web/app/[locale]/unsubscribe/unsubscribe-button.tsx +0 -94
- package/templates/apps/web/app/[locale]/unsubscribe/unsubscribe.actions.ts +0 -55
- package/templates/apps/web/app/[locale]/vs/[slug]/__tests__/page.test.tsx +0 -100
- package/templates/apps/web/app/[locale]/vs/[slug]/page.tsx +0 -60
- package/templates/apps/web/app/[locale]/whitepapers/[slug]/page.tsx +0 -54
- package/templates/apps/web/app/[locale]/whitepapers/__tests__/page-renderer-migration.test.tsx +0 -82
- package/templates/apps/web/app/[locale]/whitepapers/page.tsx +0 -49
- package/templates/apps/web/app/[locale]/working-agreement/__tests__/page.test.tsx +0 -63
- package/templates/apps/web/app/[locale]/working-agreement/page.tsx +0 -41
- package/templates/apps/web/lib/__tests__/hub-children.fixtures.ts +0 -279
- package/templates/apps/web/lib/__tests__/route-family.test.ts +0 -57
- package/templates/apps/web/lib/__tests__/service-listing.test.ts +0 -111
- package/templates/apps/web/lib/__tests__/template-listing.test.ts +0 -158
- package/templates/apps/web/lib/hub-children.tsx +0 -351
- package/templates/apps/web/lib/meet-placeholder.ts +0 -5
- package/templates/apps/web/lib/posting-title.ts +0 -39
- package/templates/apps/web/lib/route-family.ts +0 -69
- package/templates/apps/web/lib/service-listing.ts +0 -89
- package/templates/apps/web/lib/template-listing.ts +0 -169
- package/templates/apps/web/src/lib/__tests__/lead-write.test.ts +0 -187
- package/templates/apps/web/src/lib/lead-write.ts +0 -90
|
@@ -1,189 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* HTML snapshot regression tests for the careers routes → @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 across environments.
|
|
6
|
-
*
|
|
7
|
-
* Two-commit strategy:
|
|
8
|
-
* Commit 1: this file added; snapshots captured against pre-migration routes (RED-passing).
|
|
9
|
-
* Commit 2: routes migrated; same snapshots verify diff=0 (GREEN).
|
|
10
|
-
*
|
|
11
|
-
* Each route is tested in two states:
|
|
12
|
-
* - empty: getMdxSource returns null → empty-state branch
|
|
13
|
-
* - populated: getMdxSource returns a minimal MdxPageSource → full render
|
|
14
|
-
*
|
|
15
|
-
* Failure = snapshot diff > 0 bytes. DO NOT regenerate snapshots to pass.
|
|
16
|
-
* A non-zero diff indicates a behavior regression in the migration. Escalate.
|
|
17
|
-
*/
|
|
18
|
-
import React from "react";
|
|
19
|
-
import { render } from "@testing-library/react";
|
|
20
|
-
|
|
21
|
-
// ── next/navigation mock ───────────────────────────────────────────────────────
|
|
22
|
-
jest.mock("next/navigation", () => ({
|
|
23
|
-
__esModule: true,
|
|
24
|
-
notFound: jest.fn(() => {
|
|
25
|
-
throw new Error("NEXT_NOT_FOUND");
|
|
26
|
-
}),
|
|
27
|
-
}));
|
|
28
|
-
|
|
29
|
-
// ── next-mdx-remote/rsc mock ───────────────────────────────────────────────────
|
|
30
|
-
jest.mock("next-mdx-remote/rsc", () => ({
|
|
31
|
-
__esModule: true,
|
|
32
|
-
MDXRemote: ({ source }: { source: string }) =>
|
|
33
|
-
React.createElement("div", { "data-testid": "mdx-rendered" }, source),
|
|
34
|
-
}));
|
|
35
|
-
|
|
36
|
-
// ── #8746 — the careers routes once read the API and _site.mdx ────────────────
|
|
37
|
-
// Stubbed so the migration snapshot stays offline and deterministic. Since
|
|
38
|
-
// #8849 neither page reads them (the form is on the apply page, covered by
|
|
39
|
-
// job-apply-page.test.tsx).
|
|
40
|
-
jest.mock("@working-theory/api-client", () => ({
|
|
41
|
-
flows: {
|
|
42
|
-
get: jest.fn().mockResolvedValue({ ok: false, status: 404, body: null }),
|
|
43
|
-
},
|
|
44
|
-
leads: {
|
|
45
|
-
captureStatus: jest.fn().mockRejectedValue(new Error("offline")),
|
|
46
|
-
submit: jest.fn(),
|
|
47
|
-
},
|
|
48
|
-
visitorForwardHeaders: () => undefined,
|
|
49
|
-
}));
|
|
50
|
-
|
|
51
|
-
// eslint-disable-next-line no-restricted-syntax -- test-seam mock: the real read is a node:fs frontmatter parse of content/_site.mdx; narrowest possible scope
|
|
52
|
-
jest.mock("../../contact/site-contact-email", () => ({
|
|
53
|
-
readSiteContactEmail: jest.fn().mockReturnValue(undefined),
|
|
54
|
-
}));
|
|
55
|
-
|
|
56
|
-
// ── Import page components ─────────────────────────────────────────────────────
|
|
57
|
-
import CareersPage from "../page";
|
|
58
|
-
import CareersSlugPage from "../[slug]/page";
|
|
59
|
-
import * as pageRenderer from "@working-theory/page-renderer";
|
|
60
|
-
|
|
61
|
-
// #10704 — a fixture suite: its content is shaped for the mdx source, whatever the site serves from.
|
|
62
|
-
process.env.CONTENT_ADAPTER = "mdx";
|
|
63
|
-
|
|
64
|
-
// ── Shared stubs ───────────────────────────────────────────────────────────────
|
|
65
|
-
const getMdxSourceEmpty = jest.fn().mockResolvedValue(null);
|
|
66
|
-
|
|
67
|
-
// ── careers/page (index) ───────────────────────────────────────────────────────
|
|
68
|
-
|
|
69
|
-
describe("careers/page — snapshot regression", () => {
|
|
70
|
-
it("empty state renders deterministic HTML", async () => {
|
|
71
|
-
const element = await CareersPage({
|
|
72
|
-
params: Promise.resolve({ locale: "en" }),
|
|
73
|
-
getMdxSource: getMdxSourceEmpty,
|
|
74
|
-
});
|
|
75
|
-
const { container } = render(element);
|
|
76
|
-
expect(container.innerHTML).toMatchInlineSnapshot(
|
|
77
|
-
`"<main id="main"><h1 class="text-heading-1 lg:text-display-sm font-display text-fg hero-type-display">Careers</h1><p data-testid="section-empty-state">Career listings coming soon.</p></main>"`,
|
|
78
|
-
);
|
|
79
|
-
});
|
|
80
|
-
|
|
81
|
-
it("populated state renders deterministic HTML", async () => {
|
|
82
|
-
// #8849 D10 — sections mode: one generated items section per posting,
|
|
83
|
-
// first, with the search box; the ItemList carries ListItems.
|
|
84
|
-
const getMdxSourcePopulated = jest.fn<
|
|
85
|
-
ReturnType<typeof pageRenderer.getMdxSource>,
|
|
86
|
-
Parameters<typeof pageRenderer.getMdxSource>
|
|
87
|
-
>(async (type) =>
|
|
88
|
-
type === "CareersList"
|
|
89
|
-
? {
|
|
90
|
-
frontmatter: {
|
|
91
|
-
type: "CareersList" as const,
|
|
92
|
-
slug: "careers",
|
|
93
|
-
title: "Careers at AILK",
|
|
94
|
-
description: "Join the team building the AX-first platform.",
|
|
95
|
-
},
|
|
96
|
-
body: "mdx-body-content",
|
|
97
|
-
}
|
|
98
|
-
: {
|
|
99
|
-
frontmatter: {
|
|
100
|
-
type: "JobPosting" as const,
|
|
101
|
-
slug: "senior-engineer",
|
|
102
|
-
title: "Senior Engineer",
|
|
103
|
-
description: "Build the AILK platform.",
|
|
104
|
-
employmentType: "FULL_TIME" as const,
|
|
105
|
-
location: "Remote (US)",
|
|
106
|
-
},
|
|
107
|
-
body: "",
|
|
108
|
-
},
|
|
109
|
-
);
|
|
110
|
-
|
|
111
|
-
const element = await CareersPage({
|
|
112
|
-
params: Promise.resolve({ locale: "en" }),
|
|
113
|
-
getMdxSource: getMdxSourcePopulated,
|
|
114
|
-
getMdxSlugs: jest.fn().mockResolvedValue(["senior-engineer"]),
|
|
115
|
-
});
|
|
116
|
-
const { container } = render(element);
|
|
117
|
-
const jsonLd = JSON.parse(
|
|
118
|
-
container.querySelector("[data-testid='json-ld']")!.textContent!,
|
|
119
|
-
) as { mainEntity: { itemListElement: Record<string, unknown>[] } };
|
|
120
|
-
expect(jsonLd.mainEntity.itemListElement).toEqual([
|
|
121
|
-
{
|
|
122
|
-
"@type": "ListItem",
|
|
123
|
-
position: 1,
|
|
124
|
-
url: "http://localhost:3000/en/careers/senior-engineer",
|
|
125
|
-
item: {
|
|
126
|
-
"@type": "JobPosting",
|
|
127
|
-
name: "Senior Engineer",
|
|
128
|
-
description: "Build the AILK platform.",
|
|
129
|
-
},
|
|
130
|
-
},
|
|
131
|
-
]);
|
|
132
|
-
expect(
|
|
133
|
-
container.querySelector("[data-testid='items-filter-search']"),
|
|
134
|
-
).not.toBeNull();
|
|
135
|
-
expect(container.querySelector("[data-testid='mdx-body']")).toBeNull();
|
|
136
|
-
expect(container.innerHTML).toMatchInlineSnapshot(
|
|
137
|
-
`"<script type="application/ld+json" data-testid="json-ld">{"@context":"https://schema.org","@type":"CollectionPage","inLanguage":"en","name":"Careers at AILK","description":"Join the team building the AX-first platform.","mainEntity":{"@type":"ItemList","itemListElement":[{"@type":"ListItem","position":1,"url":"http://localhost:3000/en/careers/senior-engineer","item":{"@type":"JobPosting","name":"Senior Engineer","description":"Build the AILK platform."}}]}}</script><main id="main"><div class="mx-auto w-full max-w-container-xl px-4 md:px-6 lg:px-8 py-section"><h1 class="text-heading-1 lg:text-display-sm font-display text-fg hero-type-display">Careers at AILK</h1><p data-testid="careers-description" class="mt-block-tight text-lead">Join the team building the AX-first platform.</p></div><div class="ailk-section-renderer" data-testid="section-renderer"><span id="section-open-positions" class="ailk-section-anchor" aria-hidden="true" data-testid="section-anchor"></span><section class="py-section bg-(--color-bg)" data-testid="items" data-section="items"><div class="mx-auto w-full max-w-container-xl px-4 md:px-6 lg:px-8"><div class="mb-block-loose" data-testid="section-frame-header"><div><h2 class="text-heading-1 lg:text-display-sm font-display text-fg whitespace-pre-line max-w-3xl">Open positions</h2></div></div><div data-testid="items-filter-island" class="mt-10"><div class="flex flex-col gap-4 md:flex-row md:items-end" data-testid="items-filter"><div class="flex flex-col gap-1.5 md:flex-1"><div class="flex items-center justify-between gap-2"><label class="text-body-sm font-medium peer-disabled:cursor-not-allowed peer-disabled:opacity-70" for="_r_0_-search">Search roles</label></div><input data-testid="items-filter-search" class="flex rounded-control border-hairline text-body-sm text-(--color-fg) file:border-0 file:bg-transparent file:text-body-sm file:font-medium file:text-(--color-fg) placeholder:text-(--color-text-muted) focus-visible:outline-none focus-visible:ring-1 disabled:cursor-not-allowed disabled:opacity-50 motion-safe:transition-colors bg-(--color-surface-raised) border-(--color-border-strong) hover:enabled:border-transparent hover:enabled:ring-1 hover:enabled:ring-(--color-border-strong) focus-visible:border-transparent focus-visible:ring-(--color-brand) h-(--control-height-default) px-3 py-1.5 w-full" id="_r_0_-search" type="search" value=""></div><div class="flex flex-col gap-1.5 md:w-56"><div class="flex items-center justify-between gap-2"><label class="text-body-sm font-medium peer-disabled:cursor-not-allowed peer-disabled:opacity-70" for="_r_0_-type">Type</label></div><button type="button" role="combobox" aria-expanded="false" aria-autocomplete="none" dir="ltr" data-state="closed" data-testid="items-filter-facet-type" class="flex w-full items-center justify-between rounded-control border-hairline border-(--color-border) bg-(--color-surface-secondary) text-body-sm text-(--color-fg) placeholder:text-(--color-text-muted) focus-visible:outline-none focus-visible:border-transparent focus-visible:ring-1 focus-visible:ring-(--color-accent) hover:enabled:border-transparent hover:enabled:ring-1 hover:enabled:ring-(--color-border) disabled:cursor-not-allowed disabled:opacity-50 h-(--control-height-default) px-3 py-1.5 w-full" id="_r_0_-type"><span style="pointer-events: none;">All types</span><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-chevron-down size-4 opacity-50" aria-hidden="true"><path d="m6 9 6 6 6-6"></path></svg></button></div><div class="flex flex-col gap-1.5 md:w-56"><div class="flex items-center justify-between gap-2"><label class="text-body-sm font-medium peer-disabled:cursor-not-allowed peer-disabled:opacity-70" for="_r_0_-location">Location</label></div><button type="button" role="combobox" aria-expanded="false" aria-autocomplete="none" dir="ltr" data-state="closed" data-testid="items-filter-facet-location" class="flex w-full items-center justify-between rounded-control border-hairline border-(--color-border) bg-(--color-surface-secondary) text-body-sm text-(--color-fg) placeholder:text-(--color-text-muted) focus-visible:outline-none focus-visible:border-transparent focus-visible:ring-1 focus-visible:ring-(--color-accent) hover:enabled:border-transparent hover:enabled:ring-1 hover:enabled:ring-(--color-border) disabled:cursor-not-allowed disabled:opacity-50 h-(--control-height-default) px-3 py-1.5 w-full" id="_r_0_-location"><span style="pointer-events: none;">All locations</span><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-chevron-down size-4 opacity-50" aria-hidden="true"><path d="m6 9 6 6 6-6"></path></svg></button></div></div><div role="status" aria-live="polite" class="mt-4 text-body-sm text-muted" data-testid="items-filter-status">1 open position</div><div class="grid gap-grid max-w-2xl justify-items-center mx-auto mt-6" data-testid="items-grid" data-separation="gapped"><div class="contents" data-testid="items-filter-slot"><div class="h-full rounded-card p-card flex flex-col border-hairline border-(--color-border) bg-(--color-surface-raised)" data-testid="card"><span class="text-body font-body leading-normal text-fg mb-1 block text-eyebrow eyebrow-case" style="color: var(--items-item-eyebrow-color, var(--color-brand));">Full-time · Remote (US)</span><h3 class="text-heading-3 font-display text-fg">Senior Engineer</h3><p class="text-body font-body leading-normal text-(--color-text-muted) mt-2 text-sm">Build the AILK platform.</p><div class="mt-auto pt-4" data-testid="card-footer"><a class="focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-(--color-brand) rounded-sm mt-4 inline-block text-sm font-medium text-brand underline-offset-4 hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-brand" href="/careers/senior-engineer" data-testid="items-item-link-0">View role</a></div></div></div></div></div></div></section></div></main>"`,
|
|
138
|
-
);
|
|
139
|
-
});
|
|
140
|
-
});
|
|
141
|
-
|
|
142
|
-
// ── careers/[slug]/page (detail) ───────────────────────────────────────────────
|
|
143
|
-
|
|
144
|
-
describe("careers/[slug]/page — snapshot regression", () => {
|
|
145
|
-
it("populated state renders deterministic HTML", async () => {
|
|
146
|
-
const getMdxSourcePopulated = jest.fn().mockResolvedValue({
|
|
147
|
-
frontmatter: {
|
|
148
|
-
type: "JobPosting",
|
|
149
|
-
slug: "senior-engineer",
|
|
150
|
-
title: "Senior Engineer",
|
|
151
|
-
description: "Build the AILK platform.",
|
|
152
|
-
},
|
|
153
|
-
body: "mdx-body-content",
|
|
154
|
-
});
|
|
155
|
-
|
|
156
|
-
const element = await CareersSlugPage({
|
|
157
|
-
params: Promise.resolve({ locale: "en", slug: "senior-engineer" }),
|
|
158
|
-
getMdxSource: getMdxSourcePopulated,
|
|
159
|
-
});
|
|
160
|
-
const { container } = render(element);
|
|
161
|
-
// #8849 D3, D8 — the JobPosting's ApplyAction targets the apply page, and
|
|
162
|
-
// the page passes renderPage an Apply button inside <main>.
|
|
163
|
-
expect(container.innerHTML).toMatchInlineSnapshot(
|
|
164
|
-
`"<script type="application/ld+json" data-testid="json-ld">{"@context":"https://schema.org","@graph":[{"@context":"https://schema.org","@type":"WebPage","inLanguage":"en","name":"Senior Engineer","description":"Build the AILK platform.","mainEntity":{"@context":"https://schema.org","@type":"JobPosting","title":"Senior Engineer","description":"Build the AILK platform.","potentialAction":{"@type":"ApplyAction","target":"http://localhost:3000/en/careers/senior-engineer/apply"}}},{"@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":"Careers","item":"http://localhost:3000/en/careers"},{"@type":"ListItem","position":3,"name":"Senior Engineer","item":"http://localhost:3000/en/careers/senior-engineer"}]}]}</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 [&>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 [&>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 [&>*:first-child]:mt-0 [&_h2]:mt-block-loose [&_h2]:scroll-mt-24 [&_h2]:text-heading-3 [&_h2]:font-display [&_h2]:text-(--color-fg) [&_h3]:mt-block-loose [&_h3]:scroll-mt-24 [&_h3]:text-heading-4 [&_h3]:font-display [&_h3]:text-(--color-fg) [&_h4]:mt-block-tight [&_h4]:scroll-mt-24 [&_h4]:text-heading-4 [&_h4]:font-display [&_h4]:text-(--color-fg) [&_h5]:mt-block-tight [&_h5]:scroll-mt-24 [&_h5]:text-heading-4 [&_h5]:font-display [&_h5]:text-(--color-fg) [&_h6]:mt-block-tight [&_h6]:scroll-mt-24 [&_h6]:text-heading-4 [&_h6]:font-display [&_h6]:text-(--color-fg) [&_p]:mt-paragraph [&_strong]:font-semibold [&_strong]:text-(--color-fg) [&_em]:italic [&_ul]:mt-paragraph [&_ul]:list-disc [&_ul]:ps-6 [&_ol]:mt-paragraph [&_ol]:list-decimal [&_ol]:ps-6 [&_li]:mt-1 [&_li]:ps-1 [&_li]:marker:text-(--color-text-muted) [&_li>ul]:mt-1 [&_li>ol]:mt-1 [&_blockquote]:mt-paragraph [&_blockquote]:border-s-4 [&_blockquote]:border-(--color-border-strong) [&_blockquote]:ps-4 [&_blockquote]:italic [&_blockquote]:text-(--color-text-muted) [&_hr]:my-block-loose [&_hr]:border-(--color-border) [&_a]:text-(--color-accent) [&_a]:underline [&_a]:underline-offset-4 [&_:not(pre)>code]:rounded [&_:not(pre)>code]:bg-(--color-surface-secondary) [&_:not(pre)>code]:px-1.5 [&_:not(pre)>code]:py-0.5 [&_:not(pre)>code]:text-code [&_:not(pre)>code]:font-mono [&_:not(pre)>code]:text-(--color-fg) [&_pre]:mt-paragraph [&_pre]:overflow-auto [&_pre]:rounded-md [&_pre]:border-hairline [&_pre]:border-(--color-border) [&_pre]:bg-(--color-bg) [&_pre]:p-4 [&_pre]:font-mono [&_pre]:text-body-sm [&_img]:mt-paragraph [&_img]:h-auto [&_img]:max-w-full [&_img]:rounded-lg [&_table]:mt-paragraph [&_table]:w-full [&_table]:border-collapse [&_table]:text-body-sm [&_th]:border-b [&_th]:border-(--color-border) [&_th]:bg-(--color-surface-secondary) [&_th]:px-3 [&_th]:py-2 [&_th]:text-start [&_th]:font-semibold [&_th]:text-(--color-fg) [&_td]:border-b [&_td]:border-(--color-border) [&_td]:px-3 [&_td]:py-2 [&_kbd]:rounded [&_kbd]:border-hairline [&_kbd]:border-(--color-border) [&_kbd]:bg-(--color-surface-secondary) [&_kbd]:px-1.5 [&_kbd]:py-0.5 [&_kbd]:text-caption [&_kbd]:font-mono" data-testid="mdx-content"><div data-testid="mdx-rendered">mdx-body-content</div></div></article></div></div></div><div class="mx-auto w-full max-w-container-xl px-4 md:px-6 lg:px-8 pb-section"><a 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 [&>svg]:shrink-0 bg-(--color-brand) text-(--color-fg-on-brand) not-disabled:hover:bg-(--button-hover-bg) not-disabled:hover:text-(--button-hover-fg) not-disabled:hover:outline not-disabled:hover:outline-1 not-disabled:hover:-outline-offset-1 not-disabled:hover:outline-(--button-hover-border) not-disabled:hover:opacity-(--button-hover-opacity) not-disabled:hover:transform-(--button-hover-transform) not-disabled:hover:shadow-(--button-hover-shadow) not-disabled:active:opacity-80 rounded-control px-control-x min-h-(--control-height-big)" href="/careers/senior-engineer/apply" data-testid="job-apply-cta">Apply for this role</a></div></main>"`,
|
|
165
|
-
);
|
|
166
|
-
});
|
|
167
|
-
|
|
168
|
-
it("null source triggers notFound()", async () => {
|
|
169
|
-
const renderPageSpy = jest.spyOn(pageRenderer, "renderPage");
|
|
170
|
-
const { notFound } = jest.requireMock("next/navigation") as {
|
|
171
|
-
notFound: jest.MockedFunction<() => never>;
|
|
172
|
-
};
|
|
173
|
-
notFound.mockClear();
|
|
174
|
-
|
|
175
|
-
await expect(
|
|
176
|
-
CareersSlugPage({
|
|
177
|
-
params: Promise.resolve({ locale: "en", slug: "unknown" }),
|
|
178
|
-
getMdxSource: getMdxSourceEmpty,
|
|
179
|
-
}),
|
|
180
|
-
).rejects.toThrow("NEXT_NOT_FOUND");
|
|
181
|
-
// The 404 is renderPage's detail branch, not a route pre-check (#7537).
|
|
182
|
-
expect(renderPageSpy).toHaveBeenCalledTimes(1);
|
|
183
|
-
expect(
|
|
184
|
-
renderPageSpy.mock.calls[0]![0].translationsNamespace,
|
|
185
|
-
).toBeUndefined();
|
|
186
|
-
renderPageSpy.mockRestore();
|
|
187
|
-
expect(notFound).toHaveBeenCalled();
|
|
188
|
-
});
|
|
189
|
-
});
|
|
@@ -1,165 +0,0 @@
|
|
|
1
|
-
// Careers list page (#8849 D10) — the /alternatives pattern. Reads CareersList
|
|
2
|
-
// MDX via the content adapter and puts one generated `items` section first,
|
|
3
|
-
// one card per JobPosting, so the visible card grid and the CollectionPage's
|
|
4
|
-
// ItemList JSON-LD (built from the same sections) always agree. Each card
|
|
5
|
-
// links to /careers/<slug>. The section carries a search box and employment-
|
|
6
|
-
// type and location filters (the Items filter, #8849 D6) whose facets read the
|
|
7
|
-
// postings' first-class `employmentType` and `location` frontmatter, never
|
|
8
|
-
// `schema.mainEntity`. Every posting stays in the server HTML.
|
|
9
|
-
//
|
|
10
|
-
// A missing seed renders the `careers` empty state; a seed with no postings
|
|
11
|
-
// renders its declared sections alone.
|
|
12
|
-
import type {
|
|
13
|
-
getMdxSource as defaultGetMdxSource,
|
|
14
|
-
getMdxSlugs as defaultGetMdxSlugs,
|
|
15
|
-
getPageSections as defaultGetPageSections,
|
|
16
|
-
} from "@working-theory/page-renderer";
|
|
17
|
-
import {
|
|
18
|
-
getMdxSlugs as loadMdxSlugs,
|
|
19
|
-
getMdxSource as loadMdxSource,
|
|
20
|
-
getPageSections as loadPageSections,
|
|
21
|
-
renderPage,
|
|
22
|
-
renderPageMetadata,
|
|
23
|
-
} from "@working-theory/page-renderer";
|
|
24
|
-
import type { Metadata } from "next";
|
|
25
|
-
import { getTranslations } from "next-intl/server";
|
|
26
|
-
import type { ReactElement } from "react";
|
|
27
|
-
|
|
28
|
-
import { honourNavOnly } from "../../../lib/hub-children";
|
|
29
|
-
|
|
30
|
-
interface Props {
|
|
31
|
-
params: Promise<{ locale: string }>;
|
|
32
|
-
getMdxSource?: typeof defaultGetMdxSource;
|
|
33
|
-
getMdxSlugs?: typeof defaultGetMdxSlugs;
|
|
34
|
-
getPageSections?: typeof defaultGetPageSections;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
type Section = Awaited<ReturnType<typeof defaultGetPageSections>>[number];
|
|
38
|
-
|
|
39
|
-
/** Each `employmentType` value's `careers` message key. */
|
|
40
|
-
const EMPLOYMENT_TYPE_KEYS = {
|
|
41
|
-
FULL_TIME: "employmentTypeFullTime",
|
|
42
|
-
PART_TIME: "employmentTypePartTime",
|
|
43
|
-
CONTRACTOR: "employmentTypeContractor",
|
|
44
|
-
TEMPORARY: "employmentTypeTemporary",
|
|
45
|
-
INTERN: "employmentTypeIntern",
|
|
46
|
-
VOLUNTEER: "employmentTypeVolunteer",
|
|
47
|
-
PER_DIEM: "employmentTypePerDiem",
|
|
48
|
-
OTHER: "employmentTypeOther",
|
|
49
|
-
} as const;
|
|
50
|
-
|
|
51
|
-
type EmploymentType = keyof typeof EMPLOYMENT_TYPE_KEYS;
|
|
52
|
-
|
|
53
|
-
interface PostingFields {
|
|
54
|
-
title?: string;
|
|
55
|
-
description?: string;
|
|
56
|
-
publishedAt?: string;
|
|
57
|
-
employmentType?: EmploymentType;
|
|
58
|
-
location?: string;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
export async function generateMetadata({
|
|
62
|
-
params,
|
|
63
|
-
}: Pick<Props, "params">): Promise<Metadata> {
|
|
64
|
-
const { locale } = await params;
|
|
65
|
-
return renderPageMetadata({ type: "CareersList", slug: "careers", locale });
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
export default async function Page({
|
|
69
|
-
params,
|
|
70
|
-
getMdxSource,
|
|
71
|
-
getMdxSlugs,
|
|
72
|
-
getPageSections,
|
|
73
|
-
}: Props): Promise<ReactElement> {
|
|
74
|
-
const { locale } = await params;
|
|
75
|
-
const load = getMdxSource ?? loadMdxSource;
|
|
76
|
-
const listSlugs = getMdxSlugs ?? loadMdxSlugs;
|
|
77
|
-
const loadSections = getPageSections ?? loadPageSections;
|
|
78
|
-
const t = await getTranslations({ locale, namespace: "careers" });
|
|
79
|
-
|
|
80
|
-
const slugs = await listSlugs("JobPosting", locale);
|
|
81
|
-
const postings = await Promise.all(
|
|
82
|
-
slugs.map(async (slug) => {
|
|
83
|
-
const source = await load("JobPosting", slug, locale);
|
|
84
|
-
return { slug, fm: (source?.frontmatter ?? {}) as PostingFields };
|
|
85
|
-
}),
|
|
86
|
-
);
|
|
87
|
-
// Newest `publishedAt` first, then by slug; no date sorts last.
|
|
88
|
-
postings.sort(
|
|
89
|
-
(a, b) =>
|
|
90
|
-
(b.fm.publishedAt ?? "").localeCompare(a.fm.publishedAt ?? "") ||
|
|
91
|
-
a.slug.localeCompare(b.slug),
|
|
92
|
-
);
|
|
93
|
-
const source = await load("CareersList", "careers", locale);
|
|
94
|
-
honourNavOnly(
|
|
95
|
-
source?.frontmatter,
|
|
96
|
-
locale,
|
|
97
|
-
postings.map(({ slug }) => `/careers/${slug}`),
|
|
98
|
-
);
|
|
99
|
-
|
|
100
|
-
/**
|
|
101
|
-
* Put one generated `items` section first — the postings are the page's
|
|
102
|
-
* main content — followed by the declared sections. Absent when there are
|
|
103
|
-
* no postings.
|
|
104
|
-
*/
|
|
105
|
-
async function withPostings(frontmatter: unknown): Promise<Section[]> {
|
|
106
|
-
const declared = await loadSections(frontmatter);
|
|
107
|
-
if (postings.length === 0) return declared;
|
|
108
|
-
|
|
109
|
-
const items = postings.map(({ slug, fm }) => {
|
|
110
|
-
const type =
|
|
111
|
-
fm.employmentType !== undefined
|
|
112
|
-
? t(EMPLOYMENT_TYPE_KEYS[fm.employmentType])
|
|
113
|
-
: undefined;
|
|
114
|
-
const eyebrow = [type, fm.location].filter(Boolean).join(" · ");
|
|
115
|
-
const facets = {
|
|
116
|
-
...(type !== undefined && { type }),
|
|
117
|
-
...(fm.location !== undefined && { location: fm.location }),
|
|
118
|
-
};
|
|
119
|
-
return {
|
|
120
|
-
title: fm.title ?? slug,
|
|
121
|
-
description: fm.description ?? "",
|
|
122
|
-
...(eyebrow !== "" && { eyebrow }),
|
|
123
|
-
link: { label: t("viewRole"), href: `/careers/${slug}` },
|
|
124
|
-
...(Object.keys(facets).length > 0 && { facets }),
|
|
125
|
-
};
|
|
126
|
-
});
|
|
127
|
-
|
|
128
|
-
const filter = {
|
|
129
|
-
searchLabel: t("filterSearch"),
|
|
130
|
-
facets: [
|
|
131
|
-
{ key: "type", label: t("filterType"), allLabel: t("filterAllTypes") },
|
|
132
|
-
{
|
|
133
|
-
key: "location",
|
|
134
|
-
label: t("filterLocation"),
|
|
135
|
-
allLabel: t("filterAllLocations"),
|
|
136
|
-
},
|
|
137
|
-
],
|
|
138
|
-
emptyText: t("filterEmpty"),
|
|
139
|
-
// The island fills `{count}` in the browser, so the template passes
|
|
140
|
-
// through with its placeholder intact.
|
|
141
|
-
countText: {
|
|
142
|
-
one: t("filterCountOne"),
|
|
143
|
-
other: t("filterCountOther", { count: "{count}" }),
|
|
144
|
-
},
|
|
145
|
-
};
|
|
146
|
-
|
|
147
|
-
return [
|
|
148
|
-
{
|
|
149
|
-
type: "items" as const,
|
|
150
|
-
id: "open-positions",
|
|
151
|
-
data: { headline: t("openPositions"), items, filter },
|
|
152
|
-
},
|
|
153
|
-
...declared,
|
|
154
|
-
];
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
return renderPage({
|
|
158
|
-
type: "CareersList",
|
|
159
|
-
slug: "careers",
|
|
160
|
-
locale,
|
|
161
|
-
translationsNamespace: "careers",
|
|
162
|
-
getPageSections: withPostings,
|
|
163
|
-
...(getMdxSource !== undefined && { getMdxSource }),
|
|
164
|
-
});
|
|
165
|
-
}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
// Case Study detail page. Reads the CaseStudy MDX for the given slug, renders via
|
|
2
|
-
// @working-theory/page-renderer, and emits a JSON-LD <script>. Unknown slugs 404 through renderPage.
|
|
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: "CaseStudy", 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
|
-
"CaseStudy",
|
|
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: "CaseStudy",
|
|
44
|
-
slug,
|
|
45
|
-
locale,
|
|
46
|
-
...(composed ? {} : { bodyMode: "mdx-body" as const }),
|
|
47
|
-
...(getMdxSource !== undefined && { getMdxSource }),
|
|
48
|
-
});
|
|
49
|
-
}
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Hub child cards (#10121) for /case-studies. The shared cases live in
|
|
3
|
-
* `lib/__tests__/hub-children.fixtures.ts`; this file sits beside the route so
|
|
4
|
-
* a scaffold without /case-studies 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 CaseStudiesPage from "../page";
|
|
24
|
-
import {
|
|
25
|
-
describeHub,
|
|
26
|
-
type HubPage,
|
|
27
|
-
renderInput,
|
|
28
|
-
titlesOf,
|
|
29
|
-
} from "../../../../lib/__tests__/hub-children.fixtures";
|
|
30
|
-
|
|
31
|
-
describeHub(
|
|
32
|
-
[
|
|
33
|
-
"case-studies",
|
|
34
|
-
CaseStudiesPage as HubPage,
|
|
35
|
-
"CaseStudiesList",
|
|
36
|
-
"CaseStudy",
|
|
37
|
-
"mdx-body",
|
|
38
|
-
],
|
|
39
|
-
mockRenderPage,
|
|
40
|
-
);
|
|
41
|
-
|
|
42
|
-
describe("prose hub linking a child in its body", () => {
|
|
43
|
-
it("gives that child no second card", async () => {
|
|
44
|
-
const l = {
|
|
45
|
-
getMdxSource: jest.fn(async (type: string, slug: string) =>
|
|
46
|
-
type === "CaseStudiesList"
|
|
47
|
-
? {
|
|
48
|
-
frontmatter: { type, slug, title: "Hub", description: "d" },
|
|
49
|
-
body: "Read [the Acme story](/case-studies/acme).",
|
|
50
|
-
}
|
|
51
|
-
: { frontmatter: { type, slug, title: slug }, body: "" },
|
|
52
|
-
),
|
|
53
|
-
getPageSections: jest.fn(async () => []),
|
|
54
|
-
getMdxSlugs: jest.fn(async () => ["acme", "beta"]),
|
|
55
|
-
};
|
|
56
|
-
const input = await renderInput(
|
|
57
|
-
mockRenderPage,
|
|
58
|
-
CaseStudiesPage as HubPage,
|
|
59
|
-
l,
|
|
60
|
-
);
|
|
61
|
-
const sections = await input.getPageSections({});
|
|
62
|
-
expect(titlesOf(sections[0])).toEqual(["beta"]);
|
|
63
|
-
expect(input.trailing?.props.sections).toEqual(sections);
|
|
64
|
-
});
|
|
65
|
-
});
|
package/templates/apps/web/app/[locale]/case-studies/__tests__/page-renderer-migration.test.tsx
DELETED
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* HTML snapshot regression tests for the case-studies routes → @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 across environments.
|
|
6
|
-
*
|
|
7
|
-
* Two-commit strategy:
|
|
8
|
-
* Commit 1: this file added; snapshots captured against pre-migration routes (RED-passing).
|
|
9
|
-
* Commit 2: routes migrated; same snapshots verify diff=0 (GREEN).
|
|
10
|
-
*
|
|
11
|
-
* Failure = snapshot diff > 0 bytes. DO NOT regenerate snapshots to pass.
|
|
12
|
-
* A non-zero diff indicates a behavior regression in the migration. Escalate.
|
|
13
|
-
*/
|
|
14
|
-
import React from "react";
|
|
15
|
-
import { render } from "@testing-library/react";
|
|
16
|
-
|
|
17
|
-
// ── next/navigation mock ───────────────────────────────────────────────────────
|
|
18
|
-
jest.mock("next/navigation", () => ({
|
|
19
|
-
__esModule: true,
|
|
20
|
-
notFound: jest.fn(() => {
|
|
21
|
-
throw new Error("NEXT_NOT_FOUND");
|
|
22
|
-
}),
|
|
23
|
-
}));
|
|
24
|
-
|
|
25
|
-
// ── next-mdx-remote/rsc mock ───────────────────────────────────────────────────
|
|
26
|
-
jest.mock("next-mdx-remote/rsc", () => ({
|
|
27
|
-
__esModule: true,
|
|
28
|
-
MDXRemote: ({ source }: { source: string }) =>
|
|
29
|
-
React.createElement("div", { "data-testid": "mdx-rendered" }, source),
|
|
30
|
-
}));
|
|
31
|
-
|
|
32
|
-
// ── Import page components ─────────────────────────────────────────────────────
|
|
33
|
-
import CaseStudiesPage from "../page";
|
|
34
|
-
import CaseStudySlugPage from "../[slug]/page";
|
|
35
|
-
import * as pageRenderer from "@working-theory/page-renderer";
|
|
36
|
-
|
|
37
|
-
// ── Shared stubs ───────────────────────────────────────────────────────────────
|
|
38
|
-
const getMdxSourceEmpty = jest.fn().mockResolvedValue(null);
|
|
39
|
-
|
|
40
|
-
// ── case-studies/page (index) ─────────────────────────────────────────────────
|
|
41
|
-
|
|
42
|
-
describe("case-studies/page — snapshot regression", () => {
|
|
43
|
-
it("empty state renders deterministic HTML", async () => {
|
|
44
|
-
const element = await CaseStudiesPage({
|
|
45
|
-
params: Promise.resolve({ locale: "en" }),
|
|
46
|
-
// No child pages: this snapshot pins the hub's own render (#10121).
|
|
47
|
-
getMdxSlugs: async () => [],
|
|
48
|
-
getMdxSource: getMdxSourceEmpty,
|
|
49
|
-
});
|
|
50
|
-
const { container } = render(element);
|
|
51
|
-
expect(container.innerHTML).toMatchInlineSnapshot(
|
|
52
|
-
`"<main id="main"><h1 class="text-heading-1 lg:text-display-sm font-display text-fg hero-type-display">Case Studies</h1><p data-testid="section-empty-state">Case studies listing coming soon.</p></main>"`,
|
|
53
|
-
);
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
it("populated state renders deterministic HTML", async () => {
|
|
57
|
-
const getMdxSourcePopulated = jest.fn().mockResolvedValue({
|
|
58
|
-
frontmatter: {
|
|
59
|
-
type: "CaseStudiesList",
|
|
60
|
-
slug: "case-studies",
|
|
61
|
-
title: "Case Studies",
|
|
62
|
-
description: "Real-world accounts of teams using AI Launch Kit.",
|
|
63
|
-
},
|
|
64
|
-
body: "mdx-body-content",
|
|
65
|
-
});
|
|
66
|
-
|
|
67
|
-
const element = await CaseStudiesPage({
|
|
68
|
-
params: Promise.resolve({ locale: "en" }),
|
|
69
|
-
// No child pages: this snapshot pins the hub's own render (#10121).
|
|
70
|
-
getMdxSlugs: async () => [],
|
|
71
|
-
getMdxSource: getMdxSourcePopulated,
|
|
72
|
-
});
|
|
73
|
-
const { container } = render(element);
|
|
74
|
-
expect(container.innerHTML).toMatchInlineSnapshot(
|
|
75
|
-
`"<script type="application/ld+json" data-testid="json-ld">{"@context":"https://schema.org","@type":"CollectionPage","inLanguage":"en","name":"Case Studies","description":"Real-world accounts of teams using AI Launch Kit.","mainEntity":{"@type":"ItemList","itemListElement":[{"@type":"Article"}]}}</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 [&>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 [&>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 [&>*:first-child]:mt-0 [&_h2]:mt-block-loose [&_h2]:scroll-mt-24 [&_h2]:text-heading-3 [&_h2]:font-display [&_h2]:text-(--color-fg) [&_h3]:mt-block-loose [&_h3]:scroll-mt-24 [&_h3]:text-heading-4 [&_h3]:font-display [&_h3]:text-(--color-fg) [&_h4]:mt-block-tight [&_h4]:scroll-mt-24 [&_h4]:text-heading-4 [&_h4]:font-display [&_h4]:text-(--color-fg) [&_h5]:mt-block-tight [&_h5]:scroll-mt-24 [&_h5]:text-heading-4 [&_h5]:font-display [&_h5]:text-(--color-fg) [&_h6]:mt-block-tight [&_h6]:scroll-mt-24 [&_h6]:text-heading-4 [&_h6]:font-display [&_h6]:text-(--color-fg) [&_p]:mt-paragraph [&_strong]:font-semibold [&_strong]:text-(--color-fg) [&_em]:italic [&_ul]:mt-paragraph [&_ul]:list-disc [&_ul]:ps-6 [&_ol]:mt-paragraph [&_ol]:list-decimal [&_ol]:ps-6 [&_li]:mt-1 [&_li]:ps-1 [&_li]:marker:text-(--color-text-muted) [&_li>ul]:mt-1 [&_li>ol]:mt-1 [&_blockquote]:mt-paragraph [&_blockquote]:border-s-4 [&_blockquote]:border-(--color-border-strong) [&_blockquote]:ps-4 [&_blockquote]:italic [&_blockquote]:text-(--color-text-muted) [&_hr]:my-block-loose [&_hr]:border-(--color-border) [&_a]:text-(--color-accent) [&_a]:underline [&_a]:underline-offset-4 [&_:not(pre)>code]:rounded [&_:not(pre)>code]:bg-(--color-surface-secondary) [&_:not(pre)>code]:px-1.5 [&_:not(pre)>code]:py-0.5 [&_:not(pre)>code]:text-code [&_:not(pre)>code]:font-mono [&_:not(pre)>code]:text-(--color-fg) [&_pre]:mt-paragraph [&_pre]:overflow-auto [&_pre]:rounded-md [&_pre]:border-hairline [&_pre]:border-(--color-border) [&_pre]:bg-(--color-bg) [&_pre]:p-4 [&_pre]:font-mono [&_pre]:text-body-sm [&_img]:mt-paragraph [&_img]:h-auto [&_img]:max-w-full [&_img]:rounded-lg [&_table]:mt-paragraph [&_table]:w-full [&_table]:border-collapse [&_table]:text-body-sm [&_th]:border-b [&_th]:border-(--color-border) [&_th]:bg-(--color-surface-secondary) [&_th]:px-3 [&_th]:py-2 [&_th]:text-start [&_th]:font-semibold [&_th]:text-(--color-fg) [&_td]:border-b [&_td]:border-(--color-border) [&_td]:px-3 [&_td]:py-2 [&_kbd]:rounded [&_kbd]:border-hairline [&_kbd]:border-(--color-border) [&_kbd]:bg-(--color-surface-secondary) [&_kbd]:px-1.5 [&_kbd]:py-0.5 [&_kbd]:text-caption [&_kbd]:font-mono" data-testid="mdx-content"><div data-testid="mdx-rendered">mdx-body-content</div></div></article></div></div></div></main>"`,
|
|
76
|
-
);
|
|
77
|
-
});
|
|
78
|
-
});
|
|
79
|
-
|
|
80
|
-
// ── case-studies/[slug]/page (detail) ────────────────────────────────────────
|
|
81
|
-
|
|
82
|
-
describe("case-studies/[slug]/page — snapshot regression", () => {
|
|
83
|
-
it("populated state renders deterministic HTML", async () => {
|
|
84
|
-
const getMdxSourcePopulated = jest.fn().mockResolvedValue({
|
|
85
|
-
frontmatter: {
|
|
86
|
-
type: "CaseStudy",
|
|
87
|
-
slug: "ailk-aeo-rollout",
|
|
88
|
-
title: "AILK AEO Rollout",
|
|
89
|
-
description: "How a team shipped AEO with AI Launch Kit.",
|
|
90
|
-
},
|
|
91
|
-
body: "mdx-body-content",
|
|
92
|
-
});
|
|
93
|
-
|
|
94
|
-
const element = await CaseStudySlugPage({
|
|
95
|
-
params: Promise.resolve({ locale: "en", slug: "ailk-aeo-rollout" }),
|
|
96
|
-
getMdxSource: getMdxSourcePopulated,
|
|
97
|
-
});
|
|
98
|
-
const { container } = render(element);
|
|
99
|
-
expect(container.innerHTML).toMatchInlineSnapshot(
|
|
100
|
-
`"<script type="application/ld+json" data-testid="json-ld">{"@context":"https://schema.org","@graph":[{"@context":"https://schema.org","@type":"WebPage","inLanguage":"en","name":"AILK AEO Rollout","description":"How a team shipped AEO with AI Launch Kit.","mainEntity":{"@context":"https://schema.org","@type":"Article","headline":"AILK AEO Rollout","description":"How a team shipped AEO with AI Launch Kit."}},{"@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":"Case Studies","item":"http://localhost:3000/en/case-studies"},{"@type":"ListItem","position":3,"name":"AILK AEO Rollout","item":"http://localhost:3000/en/case-studies/ailk-aeo-rollout"}]}]}</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 [&>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 [&>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 [&>*:first-child]:mt-0 [&_h2]:mt-block-loose [&_h2]:scroll-mt-24 [&_h2]:text-heading-3 [&_h2]:font-display [&_h2]:text-(--color-fg) [&_h3]:mt-block-loose [&_h3]:scroll-mt-24 [&_h3]:text-heading-4 [&_h3]:font-display [&_h3]:text-(--color-fg) [&_h4]:mt-block-tight [&_h4]:scroll-mt-24 [&_h4]:text-heading-4 [&_h4]:font-display [&_h4]:text-(--color-fg) [&_h5]:mt-block-tight [&_h5]:scroll-mt-24 [&_h5]:text-heading-4 [&_h5]:font-display [&_h5]:text-(--color-fg) [&_h6]:mt-block-tight [&_h6]:scroll-mt-24 [&_h6]:text-heading-4 [&_h6]:font-display [&_h6]:text-(--color-fg) [&_p]:mt-paragraph [&_strong]:font-semibold [&_strong]:text-(--color-fg) [&_em]:italic [&_ul]:mt-paragraph [&_ul]:list-disc [&_ul]:ps-6 [&_ol]:mt-paragraph [&_ol]:list-decimal [&_ol]:ps-6 [&_li]:mt-1 [&_li]:ps-1 [&_li]:marker:text-(--color-text-muted) [&_li>ul]:mt-1 [&_li>ol]:mt-1 [&_blockquote]:mt-paragraph [&_blockquote]:border-s-4 [&_blockquote]:border-(--color-border-strong) [&_blockquote]:ps-4 [&_blockquote]:italic [&_blockquote]:text-(--color-text-muted) [&_hr]:my-block-loose [&_hr]:border-(--color-border) [&_a]:text-(--color-accent) [&_a]:underline [&_a]:underline-offset-4 [&_:not(pre)>code]:rounded [&_:not(pre)>code]:bg-(--color-surface-secondary) [&_:not(pre)>code]:px-1.5 [&_:not(pre)>code]:py-0.5 [&_:not(pre)>code]:text-code [&_:not(pre)>code]:font-mono [&_:not(pre)>code]:text-(--color-fg) [&_pre]:mt-paragraph [&_pre]:overflow-auto [&_pre]:rounded-md [&_pre]:border-hairline [&_pre]:border-(--color-border) [&_pre]:bg-(--color-bg) [&_pre]:p-4 [&_pre]:font-mono [&_pre]:text-body-sm [&_img]:mt-paragraph [&_img]:h-auto [&_img]:max-w-full [&_img]:rounded-lg [&_table]:mt-paragraph [&_table]:w-full [&_table]:border-collapse [&_table]:text-body-sm [&_th]:border-b [&_th]:border-(--color-border) [&_th]:bg-(--color-surface-secondary) [&_th]:px-3 [&_th]:py-2 [&_th]:text-start [&_th]:font-semibold [&_th]:text-(--color-fg) [&_td]:border-b [&_td]:border-(--color-border) [&_td]:px-3 [&_td]:py-2 [&_kbd]:rounded [&_kbd]:border-hairline [&_kbd]:border-(--color-border) [&_kbd]:bg-(--color-surface-secondary) [&_kbd]:px-1.5 [&_kbd]:py-0.5 [&_kbd]:text-caption [&_kbd]:font-mono" data-testid="mdx-content"><div data-testid="mdx-rendered">mdx-body-content</div></div></article></div></div></div></main>"`,
|
|
101
|
-
);
|
|
102
|
-
});
|
|
103
|
-
|
|
104
|
-
it("null source triggers notFound()", async () => {
|
|
105
|
-
const renderPageSpy = jest.spyOn(pageRenderer, "renderPage");
|
|
106
|
-
const { notFound } = jest.requireMock("next/navigation") as {
|
|
107
|
-
notFound: jest.MockedFunction<() => never>;
|
|
108
|
-
};
|
|
109
|
-
notFound.mockClear();
|
|
110
|
-
|
|
111
|
-
await expect(
|
|
112
|
-
CaseStudySlugPage({
|
|
113
|
-
params: Promise.resolve({ locale: "en", slug: "unknown" }),
|
|
114
|
-
getMdxSource: getMdxSourceEmpty,
|
|
115
|
-
}),
|
|
116
|
-
).rejects.toThrow("NEXT_NOT_FOUND");
|
|
117
|
-
// The 404 is renderPage's detail branch, not a route pre-check (#7537).
|
|
118
|
-
expect(renderPageSpy).toHaveBeenCalledTimes(1);
|
|
119
|
-
expect(
|
|
120
|
-
renderPageSpy.mock.calls[0]![0].translationsNamespace,
|
|
121
|
-
).toBeUndefined();
|
|
122
|
-
renderPageSpy.mockRestore();
|
|
123
|
-
expect(notFound).toHaveBeenCalled();
|
|
124
|
-
});
|
|
125
|
-
});
|