create-ailk 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/README.md +39 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +80 -0
- package/dist/copy.d.ts +8 -0
- package/dist/copy.js +109 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +10 -0
- package/dist/lib/pro-callout.d.ts +12 -0
- package/dist/lib/pro-callout.js +20 -0
- package/dist/parse-args.d.ts +13 -0
- package/dist/parse-args.js +81 -0
- package/dist/programmatic.d.ts +49 -0
- package/dist/programmatic.js +89 -0
- package/dist/substitute.d.ts +31 -0
- package/dist/substitute.js +45 -0
- package/dist/validate.d.ts +8 -0
- package/dist/validate.js +70 -0
- package/package.json +47 -0
- package/templates/.claude/.gitkeep +0 -0
- package/templates/.claude/agents/web.md +80 -0
- package/templates/.claude/rules/architecture.md +62 -0
- package/templates/.claude/rules/preserve-existing-style.md +51 -0
- package/templates/.claude/skills/README.md +43 -0
- package/templates/.claude/skills/add-schema/SKILL.md +270 -0
- package/templates/.claude/skills/add-schema/references/conflict-handling.md +200 -0
- package/templates/.claude/skills/add-schema/references/file-finding.md +123 -0
- package/templates/.claude/skills/add-schema/references/schema-types.md +131 -0
- package/templates/.claude/skills/audit-site/SKILL.md +213 -0
- package/templates/.claude/skills/audit-site/references/common-errors.md +113 -0
- package/templates/.claude/skills/audit-site/references/findings-glossary.md +138 -0
- package/templates/.claude/skills/audit-site/references/severity-levels.md +114 -0
- package/templates/.claude/skills/provision-config/SKILL.md +243 -0
- package/templates/.claude/skills/provision-config/references/env-vars-template.md +184 -0
- package/templates/.claude/skills/provision-config/references/runbook-template.md +248 -0
- package/templates/.claude/skills/provision-config/references/vercel-json-template.md +98 -0
- package/templates/.claude/skills/scaffold-auth/SKILL.md +261 -0
- package/templates/.claude/skills/scaffold-auth/references/env-vars.md +91 -0
- package/templates/.claude/skills/scaffold-auth/references/oauth-app-setup.md +171 -0
- package/templates/.claude/skills/scaffold-commerce/SKILL.md +310 -0
- package/templates/.claude/skills/scaffold-commerce/references/lookup-keys-template.md +71 -0
- package/templates/.claude/skills/scaffold-commerce/references/marketplace-brand-pages.md +83 -0
- package/templates/.claude/skills/scaffold-commerce/templates/marketplace-cta-route.tsx.tmpl +72 -0
- package/templates/.claude/skills/scaffold-page/SKILL.md +243 -0
- package/templates/.claude/skills/scaffold-page/references/page-types.md +169 -0
- package/templates/.claude/skills/scaffold-page/templates/content.mdx.tmpl +28 -0
- package/templates/.claude/skills/scaffold-page/templates/route.tsx.tmpl +28 -0
- package/templates/.claude/skills/suggest-site-pages/SKILL.md +242 -0
- package/templates/.claude/skills/suggest-site-pages/references/categories.md +287 -0
- package/templates/.env.example +205 -0
- package/templates/.gitkeep +2 -0
- package/templates/CLAUDE.md +142 -0
- package/templates/CONVENTIONS.md +222 -0
- package/templates/README.md +110 -0
- package/templates/apps/api/.env.example +40 -0
- package/templates/apps/api/CLAUDE.md +63 -0
- package/templates/apps/api/api/index.ts +144 -0
- package/templates/apps/api/jest.config.cjs +74 -0
- package/templates/apps/api/package.json +54 -0
- package/templates/apps/api/src/__tests__/factories/content-fixture.ts +138 -0
- package/templates/apps/api/src/__tests__/factories/index.ts +70 -0
- package/templates/apps/api/src/__tests__/factories/lead-fixture.ts +82 -0
- package/templates/apps/api/src/__tests__/index.test.ts +118 -0
- package/templates/apps/api/src/__tests__/server.test.ts +207 -0
- package/templates/apps/api/src/__tests__/services/enrichment-shim.test.ts +126 -0
- package/templates/apps/api/src/__tests__/setup.ts +24 -0
- package/templates/apps/api/src/cli.ts +30 -0
- package/templates/apps/api/src/config/__tests__/index.test.ts +97 -0
- package/templates/apps/api/src/config/index.ts +56 -0
- package/templates/apps/api/src/index.ts +32 -0
- package/templates/apps/api/src/lib/__mocks__/prisma-client.js +15 -0
- package/templates/apps/api/src/lib/__mocks__/prisma.ts +45 -0
- package/templates/apps/api/src/lib/__tests__/content-adapter.test.ts +178 -0
- package/templates/apps/api/src/lib/__tests__/error-serializer.test.ts +100 -0
- package/templates/apps/api/src/lib/__tests__/errors.test.ts +94 -0
- package/templates/apps/api/src/lib/__tests__/file-fallback.test.ts +144 -0
- package/templates/apps/api/src/lib/__tests__/fixtures/HomePage/home.mdx +8 -0
- package/templates/apps/api/src/lib/__tests__/lead-capture-store.test.ts +227 -0
- package/templates/apps/api/src/lib/__tests__/outbound-http.test.ts +125 -0
- package/templates/apps/api/src/lib/__tests__/prisma.test.ts +165 -0
- package/templates/apps/api/src/lib/__tests__/require-paid-tier.test.ts +129 -0
- package/templates/apps/api/src/lib/__tests__/stripe.test.ts +74 -0
- package/templates/apps/api/src/lib/content-adapter.ts +86 -0
- package/templates/apps/api/src/lib/error-serializer.ts +77 -0
- package/templates/apps/api/src/lib/errors.ts +95 -0
- package/templates/apps/api/src/lib/file-fallback.ts +87 -0
- package/templates/apps/api/src/lib/lead-capture-store.ts +110 -0
- package/templates/apps/api/src/lib/locales.ts +201 -0
- package/templates/apps/api/src/lib/outbound-http.ts +122 -0
- package/templates/apps/api/src/lib/prisma.ts +21 -0
- package/templates/apps/api/src/lib/require-paid-tier.ts +53 -0
- package/templates/apps/api/src/lib/stripe.ts +30 -0
- package/templates/apps/api/src/lib/webhook-idempotency.ts +92 -0
- package/templates/apps/api/src/middleware/__tests__/adversarial/bearer-token-format.test.ts +111 -0
- package/templates/apps/api/src/middleware/__tests__/adversarial/cookie-or-bearer-precedence.test.ts +172 -0
- package/templates/apps/api/src/middleware/__tests__/adversarial/csrf-bearer-skip.test.ts +119 -0
- package/templates/apps/api/src/middleware/__tests__/adversarial/csrf-cookie-path.test.ts +138 -0
- package/templates/apps/api/src/middleware/__tests__/adversarial/session-fixation.test.ts +149 -0
- package/templates/apps/api/src/middleware/__tests__/adversarial/session-timeout.test.ts +139 -0
- package/templates/apps/api/src/middleware/__tests__/auth.bearer-path.test.ts +175 -0
- package/templates/apps/api/src/middleware/__tests__/auth.both-present-precedence.test.ts +76 -0
- package/templates/apps/api/src/middleware/__tests__/auth.cookie-path.test.ts +153 -0
- package/templates/apps/api/src/middleware/__tests__/auth.neither-present.test.ts +72 -0
- package/templates/apps/api/src/middleware/__tests__/rate-limit.test.ts +292 -0
- package/templates/apps/api/src/middleware/auth.ts +246 -0
- package/templates/apps/api/src/middleware/rate-limit.ts +132 -0
- package/templates/apps/api/src/openapi/__tests__/openapi.test.ts +129 -0
- package/templates/apps/api/src/openapi/index.ts +12 -0
- package/templates/apps/api/src/openapi/spec.ts +408 -0
- package/templates/apps/api/src/routes/auth/__tests__/auth-tokens.functional.test.ts +193 -0
- package/templates/apps/api/src/routes/auth/__tests__/auth-user.functional.test.ts +201 -0
- package/templates/apps/api/src/routes/auth/__tests__/tokens.test.ts +294 -0
- package/templates/apps/api/src/routes/auth/__tests__/user.test.ts +486 -0
- package/templates/apps/api/src/routes/auth/tokens.ts +199 -0
- package/templates/apps/api/src/routes/auth/user.ts +244 -0
- package/templates/apps/api/src/routes/checkout/__tests__/sessions.test.ts +588 -0
- package/templates/apps/api/src/routes/checkout/index.ts +13 -0
- package/templates/apps/api/src/routes/checkout/sessions.ts +185 -0
- package/templates/apps/api/src/routes/content/__tests__/create.test.ts +239 -0
- package/templates/apps/api/src/routes/content/__tests__/delete.test.ts +201 -0
- package/templates/apps/api/src/routes/content/__tests__/get-page.test.ts +141 -0
- package/templates/apps/api/src/routes/content/__tests__/list-pages.test.ts +122 -0
- package/templates/apps/api/src/routes/content/__tests__/list-types.test.ts +44 -0
- package/templates/apps/api/src/routes/content/__tests__/locale.test.ts +118 -0
- package/templates/apps/api/src/routes/content/__tests__/rate-limit.test.ts +51 -0
- package/templates/apps/api/src/routes/content/__tests__/update.test.ts +252 -0
- package/templates/apps/api/src/routes/content/create.ts +114 -0
- package/templates/apps/api/src/routes/content/delete.ts +81 -0
- package/templates/apps/api/src/routes/content/get-page.ts +98 -0
- package/templates/apps/api/src/routes/content/index.ts +32 -0
- package/templates/apps/api/src/routes/content/list-pages.ts +83 -0
- package/templates/apps/api/src/routes/content/list-types.ts +19 -0
- package/templates/apps/api/src/routes/content/rate-limit.ts +13 -0
- package/templates/apps/api/src/routes/content/slug.ts +9 -0
- package/templates/apps/api/src/routes/content/update.ts +111 -0
- package/templates/apps/api/src/routes/leads/__tests__/index.test.ts +415 -0
- package/templates/apps/api/src/routes/leads/__tests__/track.test.ts +165 -0
- package/templates/apps/api/src/routes/leads/index.ts +130 -0
- package/templates/apps/api/src/routes/test/auth/__tests__/session.test.ts +296 -0
- package/templates/apps/api/src/routes/test/auth/session.ts +141 -0
- package/templates/apps/api/src/routes/webhooks/README.md +57 -0
- package/templates/apps/api/src/routes/webhooks/__tests__/stripe-idempotency.test.ts +247 -0
- package/templates/apps/api/src/routes/webhooks/__tests__/stripe-rate-limit.test.ts +198 -0
- package/templates/apps/api/src/routes/webhooks/__tests__/stripe.test.ts +633 -0
- package/templates/apps/api/src/routes/webhooks/index.ts +41 -0
- package/templates/apps/api/src/routes/webhooks/stripe.ts +253 -0
- package/templates/apps/api/src/server.ts +157 -0
- package/templates/apps/api/src/services/__tests__/lead-routing.test.ts +395 -0
- package/templates/apps/api/src/services/enrichment-shim.ts +53 -0
- package/templates/apps/api/src/services/lead-routing.ts +338 -0
- package/templates/apps/api/tsconfig.json +34 -0
- package/templates/apps/api/vercel.json +17 -0
- package/templates/apps/mcp/.env.example +52 -0
- package/templates/apps/mcp/CLAUDE.md +84 -0
- package/templates/apps/mcp/__tests__/abuse/daily-cap.test.ts +52 -0
- package/templates/apps/mcp/__tests__/abuse/email-validator.test.ts +46 -0
- package/templates/apps/mcp/__tests__/abuse/honeypot.test.ts +36 -0
- package/templates/apps/mcp/__tests__/abuse/user-agent-deny.test.ts +54 -0
- package/templates/apps/mcp/__tests__/aeo-cli-parity.test.ts +110 -0
- package/templates/apps/mcp/__tests__/audit-single-page.test.ts +213 -0
- package/templates/apps/mcp/__tests__/audit.test.ts +217 -0
- package/templates/apps/mcp/__tests__/catalog-drift.test.ts +52 -0
- package/templates/apps/mcp/__tests__/create_page.test.ts +201 -0
- package/templates/apps/mcp/__tests__/delete_page.test.ts +176 -0
- package/templates/apps/mcp/__tests__/get_business_hours.test.ts +82 -0
- package/templates/apps/mcp/__tests__/get_faq.test.ts +80 -0
- package/templates/apps/mcp/__tests__/get_locations.test.ts +65 -0
- package/templates/apps/mcp/__tests__/get_offerings.test.ts +90 -0
- package/templates/apps/mcp/__tests__/get_pricing.test.ts +80 -0
- package/templates/apps/mcp/__tests__/get_site_info.test.ts +81 -0
- package/templates/apps/mcp/__tests__/http-transport.test.ts +323 -0
- package/templates/apps/mcp/__tests__/lib/errors.test.ts +75 -0
- package/templates/apps/mcp/__tests__/lib/require-paid-tier.test.ts +75 -0
- package/templates/apps/mcp/__tests__/list_pages.test.ts +112 -0
- package/templates/apps/mcp/__tests__/locale.test.ts +135 -0
- package/templates/apps/mcp/__tests__/parity.test.ts +205 -0
- package/templates/apps/mcp/__tests__/purchase-disabled.test.ts +34 -0
- package/templates/apps/mcp/__tests__/read_content.test.ts +153 -0
- package/templates/apps/mcp/__tests__/request_callback.test.ts +163 -0
- package/templates/apps/mcp/__tests__/search_content.test.ts +153 -0
- package/templates/apps/mcp/__tests__/server.test.ts +115 -0
- package/templates/apps/mcp/__tests__/submit_lead.test.ts +165 -0
- package/templates/apps/mcp/__tests__/subscribe_newsletter.test.ts +161 -0
- package/templates/apps/mcp/__tests__/tools/purchase.test.ts +227 -0
- package/templates/apps/mcp/__tests__/tools/scaffold.test.ts +237 -0
- package/templates/apps/mcp/__tests__/update_page.test.ts +195 -0
- package/templates/apps/mcp/jest.config.cjs +82 -0
- package/templates/apps/mcp/package.json +37 -0
- package/templates/apps/mcp/src/abuse/daily-cap.ts +47 -0
- package/templates/apps/mcp/src/abuse/email-validator.ts +25 -0
- package/templates/apps/mcp/src/abuse/honeypot.ts +21 -0
- package/templates/apps/mcp/src/abuse/index.ts +111 -0
- package/templates/apps/mcp/src/abuse/user-agent-deny.ts +58 -0
- package/templates/apps/mcp/src/http-transport.ts +303 -0
- package/templates/apps/mcp/src/index.ts +67 -0
- package/templates/apps/mcp/src/lib/audit-single-page.ts +194 -0
- package/templates/apps/mcp/src/lib/errors.ts +61 -0
- package/templates/apps/mcp/src/lib/locales.ts +171 -0
- package/templates/apps/mcp/src/lib/require-paid-tier.ts +44 -0
- package/templates/apps/mcp/src/lib/resolve-locale.ts +30 -0
- package/templates/apps/mcp/src/server.ts +139 -0
- package/templates/apps/mcp/src/tools/audit.ts +103 -0
- package/templates/apps/mcp/src/tools/capture_lead.ts +52 -0
- package/templates/apps/mcp/src/tools/create_page.ts +95 -0
- package/templates/apps/mcp/src/tools/delete_page.ts +73 -0
- package/templates/apps/mcp/src/tools/get_business_hours.ts +66 -0
- package/templates/apps/mcp/src/tools/get_faq.ts +69 -0
- package/templates/apps/mcp/src/tools/get_locations.ts +85 -0
- package/templates/apps/mcp/src/tools/get_offerings.ts +66 -0
- package/templates/apps/mcp/src/tools/get_pricing.ts +74 -0
- package/templates/apps/mcp/src/tools/get_site_info.ts +84 -0
- package/templates/apps/mcp/src/tools/index.ts +125 -0
- package/templates/apps/mcp/src/tools/list_pages.ts +72 -0
- package/templates/apps/mcp/src/tools/purchase.ts +89 -0
- package/templates/apps/mcp/src/tools/read_content.ts +61 -0
- package/templates/apps/mcp/src/tools/request_callback.ts +51 -0
- package/templates/apps/mcp/src/tools/scaffold.ts +119 -0
- package/templates/apps/mcp/src/tools/search_content.ts +59 -0
- package/templates/apps/mcp/src/tools/subscribe_newsletter.ts +47 -0
- package/templates/apps/mcp/src/tools/update_page.ts +91 -0
- package/templates/apps/mcp/tsconfig.json +19 -0
- package/templates/apps/web/.env.example +47 -0
- package/templates/apps/web/CLAUDE.md +81 -0
- package/templates/apps/web/__tests__/auth/adversarial/cookie-attributes.test.ts +94 -0
- package/templates/apps/web/__tests__/auth/adversarial/oauth-state-parameter.test.ts +75 -0
- package/templates/apps/web/__tests__/auth/adversarial/redirect-uri-allowlist.test.ts +82 -0
- package/templates/apps/web/__tests__/auth/env-helpers.test.ts +168 -0
- package/templates/apps/web/__tests__/authority-list-routes.test.tsx +208 -0
- package/templates/apps/web/__tests__/better-stack.test.ts +66 -0
- package/templates/apps/web/__tests__/blog-dir-resolution.test.ts +87 -0
- package/templates/apps/web/__tests__/blog-source-populated.test.ts +130 -0
- package/templates/apps/web/__tests__/data-testid-coverage.test.tsx +60 -0
- package/templates/apps/web/__tests__/google-analytics.test.tsx +104 -0
- package/templates/apps/web/__tests__/i18n/middleware.test.ts +119 -0
- package/templates/apps/web/__tests__/i18n/routing.test.ts +114 -0
- package/templates/apps/web/__tests__/i18n/translations.test.ts +191 -0
- package/templates/apps/web/__tests__/json-ld.test.ts +98 -0
- package/templates/apps/web/__tests__/knowledge-events-routes.test.tsx +580 -0
- package/templates/apps/web/__tests__/layout-stealth.test.ts +39 -0
- package/templates/apps/web/__tests__/lighthouse-fixtures/improvement-image-shrink.tsx +103 -0
- package/templates/apps/web/__tests__/lighthouse-fixtures/override-fixture.md +114 -0
- package/templates/apps/web/__tests__/lighthouse-fixtures/regression-bloat.tsx +94 -0
- package/templates/apps/web/__tests__/page.test.tsx +230 -0
- package/templates/apps/web/__tests__/products-services-phase1.test.tsx +321 -0
- package/templates/apps/web/__tests__/projects-routes.test.tsx +392 -0
- package/templates/apps/web/__tests__/resources-downloads-integrations-phase2.test.tsx +475 -0
- package/templates/apps/web/__tests__/routes/ai-plugin-json.test.ts +53 -0
- package/templates/apps/web/__tests__/routes/blog-route.test.tsx +191 -0
- package/templates/apps/web/__tests__/routes/llms-txt.test.ts +123 -0
- package/templates/apps/web/__tests__/routes/robots-txt.test.ts +52 -0
- package/templates/apps/web/__tests__/routes/sitemap-xml.test.ts +78 -0
- package/templates/apps/web/__tests__/routes/well-known-mcp.test.ts +203 -0
- package/templates/apps/web/__tests__/section-routes.test.tsx +693 -0
- package/templates/apps/web/__tests__/security-headers.test.ts +201 -0
- package/templates/apps/web/__tests__/sentry-config.test.ts +116 -0
- package/templates/apps/web/__tests__/setup.ts +82 -0
- package/templates/apps/web/__tests__/sitemap-locales.test.ts +415 -0
- package/templates/apps/web/__tests__/standalone-informational-routes.test.tsx +844 -0
- package/templates/apps/web/app/.well-known/ai-plugin.json/route.ts +81 -0
- package/templates/apps/web/app/.well-known/mcp.json/build-manifest.ts +110 -0
- package/templates/apps/web/app/.well-known/mcp.json/route.ts +58 -0
- package/templates/apps/web/app/[locale]/__tests__/layout.test.tsx +120 -0
- package/templates/apps/web/app/[locale]/__tests__/page-renderer-migration.test.tsx +202 -0
- package/templates/apps/web/app/[locale]/about/page.tsx +31 -0
- package/templates/apps/web/app/[locale]/blog/[[...slug]]/page.tsx +173 -0
- package/templates/apps/web/app/[locale]/careers/[slug]/page.tsx +45 -0
- package/templates/apps/web/app/[locale]/careers/__tests__/page-renderer-migration.test.tsx +117 -0
- package/templates/apps/web/app/[locale]/careers/page.tsx +25 -0
- package/templates/apps/web/app/[locale]/case-studies/[slug]/page.tsx +44 -0
- package/templates/apps/web/app/[locale]/case-studies/__tests__/page-renderer-migration.test.tsx +113 -0
- package/templates/apps/web/app/[locale]/case-studies/page.tsx +25 -0
- package/templates/apps/web/app/[locale]/clients/__tests__/page-renderer-migration.test.tsx +63 -0
- package/templates/apps/web/app/[locale]/clients/page.tsx +27 -0
- package/templates/apps/web/app/[locale]/contact/ContactForm.tsx +130 -0
- package/templates/apps/web/app/[locale]/contact/__tests__/contact.actions.test.ts +152 -0
- package/templates/apps/web/app/[locale]/contact/__tests__/page-renderer-migration.test.tsx +92 -0
- package/templates/apps/web/app/[locale]/contact/contact.actions.ts +79 -0
- package/templates/apps/web/app/[locale]/contact/error.tsx +24 -0
- package/templates/apps/web/app/[locale]/contact/page.tsx +38 -0
- package/templates/apps/web/app/[locale]/courses/[slug]/page.tsx +34 -0
- package/templates/apps/web/app/[locale]/courses/__tests__/page-renderer-migration.test.tsx +119 -0
- package/templates/apps/web/app/[locale]/courses/page.tsx +25 -0
- package/templates/apps/web/app/[locale]/dev/purchase/__tests__/actions.test.ts +160 -0
- package/templates/apps/web/app/[locale]/dev/purchase/error.tsx +25 -0
- package/templates/apps/web/app/[locale]/dev/purchase/page.tsx +117 -0
- package/templates/apps/web/app/[locale]/dev/purchase/purchase.actions.ts +58 -0
- package/templates/apps/web/app/[locale]/docs/[[...slug]]/page.tsx +118 -0
- package/templates/apps/web/app/[locale]/downloads/__tests__/page-renderer-migration.test.tsx +72 -0
- package/templates/apps/web/app/[locale]/downloads/page.tsx +25 -0
- package/templates/apps/web/app/[locale]/events/[slug]/page.tsx +47 -0
- package/templates/apps/web/app/[locale]/events/__tests__/page-renderer-migration.test.tsx +130 -0
- package/templates/apps/web/app/[locale]/events/page.tsx +25 -0
- package/templates/apps/web/app/[locale]/faq/page.tsx +36 -0
- package/templates/apps/web/app/[locale]/how-to/[slug]/page.tsx +34 -0
- package/templates/apps/web/app/[locale]/how-to/__tests__/page-renderer-migration.test.tsx +78 -0
- package/templates/apps/web/app/[locale]/how-to/page.tsx +40 -0
- package/templates/apps/web/app/[locale]/integrations/[slug]/page.tsx +43 -0
- package/templates/apps/web/app/[locale]/integrations/__tests__/page-renderer-migration.test.tsx +129 -0
- package/templates/apps/web/app/[locale]/integrations/page.tsx +25 -0
- package/templates/apps/web/app/[locale]/launch-service/page.tsx +31 -0
- package/templates/apps/web/app/[locale]/layout.tsx +241 -0
- package/templates/apps/web/app/[locale]/page.tsx +41 -0
- package/templates/apps/web/app/[locale]/partners/[slug]/page.tsx +44 -0
- package/templates/apps/web/app/[locale]/partners/__tests__/page-renderer-migration.test.tsx +113 -0
- package/templates/apps/web/app/[locale]/partners/page.tsx +25 -0
- package/templates/apps/web/app/[locale]/products/[slug]/page.tsx +43 -0
- package/templates/apps/web/app/[locale]/products/__tests__/page-renderer-migration.test.tsx +129 -0
- package/templates/apps/web/app/[locale]/products/page.tsx +25 -0
- package/templates/apps/web/app/[locale]/projects/[slug]/page.tsx +39 -0
- package/templates/apps/web/app/[locale]/projects/__tests__/page-renderer-migration.test.tsx +138 -0
- package/templates/apps/web/app/[locale]/projects/page.tsx +30 -0
- package/templates/apps/web/app/[locale]/resources/[slug]/page.tsx +51 -0
- package/templates/apps/web/app/[locale]/resources/__tests__/page-renderer-migration.test.tsx +117 -0
- package/templates/apps/web/app/[locale]/resources/page.tsx +27 -0
- package/templates/apps/web/app/[locale]/services/[slug]/page.tsx +43 -0
- package/templates/apps/web/app/[locale]/services/__tests__/page-renderer-migration.test.tsx +129 -0
- package/templates/apps/web/app/[locale]/services/page.tsx +25 -0
- package/templates/apps/web/app/[locale]/software/[slug]/page.tsx +34 -0
- package/templates/apps/web/app/[locale]/software/__tests__/page-renderer-migration.test.tsx +81 -0
- package/templates/apps/web/app/[locale]/software/page.tsx +39 -0
- package/templates/apps/web/app/[locale]/tech-articles/[slug]/page.tsx +34 -0
- package/templates/apps/web/app/[locale]/tech-articles/__tests__/page-renderer-migration.test.tsx +82 -0
- package/templates/apps/web/app/[locale]/tech-articles/page.tsx +39 -0
- package/templates/apps/web/app/[locale]/testimonials/__tests__/page-renderer-migration.test.tsx +63 -0
- package/templates/apps/web/app/[locale]/testimonials/page.tsx +27 -0
- package/templates/apps/web/app/[locale]/use-cases/__tests__/page-renderer-migration.test.tsx +63 -0
- package/templates/apps/web/app/[locale]/use-cases/page.tsx +27 -0
- package/templates/apps/web/app/[locale]/whitepapers/[slug]/page.tsx +34 -0
- package/templates/apps/web/app/[locale]/whitepapers/__tests__/page-renderer-migration.test.tsx +82 -0
- package/templates/apps/web/app/[locale]/whitepapers/page.tsx +39 -0
- package/templates/apps/web/app/__tests__/error-boundaries.test.tsx +152 -0
- package/templates/apps/web/app/api/auth/[...all]/route.ts +16 -0
- package/templates/apps/web/app/error-fallback.tsx +75 -0
- package/templates/apps/web/app/error.tsx +23 -0
- package/templates/apps/web/app/layout.tsx +18 -0
- package/templates/apps/web/app/llms.txt/route.ts +101 -0
- package/templates/apps/web/app/not-found.tsx +48 -0
- package/templates/apps/web/app/og/__tests__/route.test.ts +164 -0
- package/templates/apps/web/app/og/route.tsx +135 -0
- package/templates/apps/web/app/robots.txt/route.ts +36 -0
- package/templates/apps/web/app/sitemap.xml/route.ts +146 -0
- package/templates/apps/web/auth.ts +141 -0
- package/templates/apps/web/components/ThemeToggle.tsx +60 -0
- package/templates/apps/web/components/google-analytics.tsx +34 -0
- package/templates/apps/web/content/en/blog/index.mdx +15 -0
- package/templates/apps/web/content/en/blog/launching-ailk.mdx +20 -0
- package/templates/apps/web/content/en/docs/getting-started.mdx +30 -0
- package/templates/apps/web/i18n/request.ts +36 -0
- package/templates/apps/web/jest.config.cjs +100 -0
- package/templates/apps/web/lib/__mocks__/next-mdx-remote-rsc.js +12 -0
- package/templates/apps/web/lib/__mocks__/source-server.js +31 -0
- package/templates/apps/web/lib/__tests__/og.test.ts +65 -0
- package/templates/apps/web/lib/auth-env.ts +66 -0
- package/templates/apps/web/lib/blog-list-data.ts +95 -0
- package/templates/apps/web/lib/blog-post-data.ts +79 -0
- package/templates/apps/web/lib/nav-config.ts +13 -0
- package/templates/apps/web/lib/observability/better-stack.ts +27 -0
- package/templates/apps/web/lib/og.ts +23 -0
- package/templates/apps/web/lib/prisma-for-auth.ts +34 -0
- package/templates/apps/web/lib/source.ts +34 -0
- package/templates/apps/web/messages/en.json +131 -0
- package/templates/apps/web/middleware.ts +80 -0
- package/templates/apps/web/next.config.mjs +167 -0
- package/templates/apps/web/package.json +62 -0
- package/templates/apps/web/public/.well-known/security.txt +17 -0
- package/templates/apps/web/public/android-chrome-192x192.png +0 -0
- package/templates/apps/web/public/android-chrome-512x512.png +0 -0
- package/templates/apps/web/public/apple-touch-icon.png +0 -0
- package/templates/apps/web/public/favicon-16x16.png +0 -0
- package/templates/apps/web/public/favicon-32x32.png +0 -0
- package/templates/apps/web/public/favicon.ico +0 -0
- package/templates/apps/web/public/favicon.svg +4 -0
- package/templates/apps/web/public/logo-dark.svg +21 -0
- package/templates/apps/web/public/logo-light.svg +21 -0
- package/templates/apps/web/public/logomark-dark.svg +4 -0
- package/templates/apps/web/public/logomark-light.svg +4 -0
- package/templates/apps/web/public/og-default.png +0 -0
- package/templates/apps/web/public/site.webmanifest +19 -0
- package/templates/apps/web/scripts/assert-content-bundled.ts +55 -0
- package/templates/apps/web/security-headers.config.ts +132 -0
- package/templates/apps/web/sentry.client.config.ts +27 -0
- package/templates/apps/web/sentry.edge.config.ts +15 -0
- package/templates/apps/web/sentry.server.config.ts +20 -0
- package/templates/apps/web/source.config.ts +78 -0
- package/templates/apps/web/src/components/SiteNav.tsx +21 -0
- package/templates/apps/web/src/lib/routes.ts +37 -0
- package/templates/apps/web/tsconfig.json +35 -0
- package/templates/apps/web/types/messages.d.ts +19 -0
- package/templates/content/.gitkeep +0 -0
- package/templates/content/CLAUDE.md +85 -0
- package/templates/content/_site.mdx +38 -0
- package/templates/content/ar/HomePage/home.mdx +123 -0
- package/templates/content/ar/_site.mdx +35 -0
- package/templates/content/de/_site.mdx +29 -0
- package/templates/content/en/.gitkeep +0 -0
- package/templates/content/en/AboutPage/about.mdx +19 -0
- package/templates/content/en/AboutPage/about.schema.json +82 -0
- package/templates/content/en/BookCall/book-call.mdx +19 -0
- package/templates/content/en/BookCall/book-call.schema.json +121 -0
- package/templates/content/en/BreadcrumbList/site-breadcrumbs.mdx +20 -0
- package/templates/content/en/CareersList/careers.mdx +24 -0
- package/templates/content/en/CaseStudiesList/case-studies.mdx +22 -0
- package/templates/content/en/CaseStudiesList/showcase.mdx +8 -0
- package/templates/content/en/CaseStudy/ailk-aeo-rollout.mdx +32 -0
- package/templates/content/en/CaseStudy/schema-builder-migration.mdx +41 -0
- package/templates/content/en/ClientsList/clients.mdx +38 -0
- package/templates/content/en/ContactPage/contact.mdx +19 -0
- package/templates/content/en/ContactPage/contact.schema.json +100 -0
- package/templates/content/en/ContactPoint/primary.mdx +14 -0
- package/templates/content/en/Course/aeo-fundamentals.mdx +37 -0
- package/templates/content/en/Course/schema-builder-workshop.mdx +62 -0
- package/templates/content/en/CoursesList/courses.mdx +22 -0
- package/templates/content/en/DownloadsList/downloads.mdx +22 -0
- package/templates/content/en/Event/aeo-office-hours-may-2026.mdx +39 -0
- package/templates/content/en/Event/ailk-launch-day-2026.mdx +35 -0
- package/templates/content/en/EventsList/events.mdx +26 -0
- package/templates/content/en/FAQPage/faq.mdx +420 -0
- package/templates/content/en/FAQPage/faq.schema.json +231 -0
- package/templates/content/en/GlossaryList/glossary.mdx +19 -0
- package/templates/content/en/GlossaryList/glossary.schema.json +300 -0
- package/templates/content/en/HomePage/home.mdx +312 -0
- package/templates/content/en/HomePage/home.schema.json +88 -0
- package/templates/content/en/HomePage/launch-service.mdx +475 -0
- package/templates/content/en/HomePage/launch-service.schema.json +138 -0
- package/templates/content/en/HowTo/add-mdx-content.mdx +38 -0
- package/templates/content/en/HowTo/configure-aeo-scoring.mdx +35 -0
- package/templates/content/en/HowTo/set-up-json-ld.mdx +36 -0
- package/templates/content/en/Integration/github-actions.mdx +31 -0
- package/templates/content/en/Integration/openai-api.mdx +26 -0
- package/templates/content/en/Integration/vercel.mdx +32 -0
- package/templates/content/en/IntegrationsList/integrations.mdx +22 -0
- package/templates/content/en/JobPosting/content-strategist.mdx +46 -0
- package/templates/content/en/JobPosting/developer-advocate.mdx +47 -0
- package/templates/content/en/JobPosting/senior-fullstack-engineer.mdx +57 -0
- package/templates/content/en/LandingPage/aeo-audit.mdx +19 -0
- package/templates/content/en/LandingPage/aeo-audit.schema.json +92 -0
- package/templates/content/en/LandingPage/agency-waitlist.mdx +340 -0
- package/templates/content/en/LandingPage/agency-waitlist.schema.json +152 -0
- package/templates/content/en/LandingPage/developers.mdx +19 -0
- package/templates/content/en/LandingPage/developers.schema.json +109 -0
- package/templates/content/en/LandingPage/for-agencies.mdx +390 -0
- package/templates/content/en/LandingPage/for-agencies.schema.json +107 -0
- package/templates/content/en/LandingPage/for-ai-search-agencies.mdx +417 -0
- package/templates/content/en/LandingPage/for-ai-search-agencies.schema.json +105 -0
- package/templates/content/en/LandingPage/for-businesses.mdx +19 -0
- package/templates/content/en/LandingPage/for-businesses.schema.json +96 -0
- package/templates/content/en/LandingPage/platform.mdx +369 -0
- package/templates/content/en/LandingPage/platform.schema.json +166 -0
- package/templates/content/en/LandingPage/vs-ai-website-builders.mdx +19 -0
- package/templates/content/en/LandingPage/vs-ai-website-builders.schema.json +102 -0
- package/templates/content/en/LandingPage/vs-wordpress.mdx +19 -0
- package/templates/content/en/LandingPage/vs-wordpress.schema.json +53 -0
- package/templates/content/en/NewsletterSignup/newsletter.mdx +236 -0
- package/templates/content/en/NewsletterSignup/newsletter.schema.json +91 -0
- package/templates/content/en/Organization/site-owner.mdx +16 -0
- package/templates/content/en/Partner/prisma.mdx +31 -0
- package/templates/content/en/Partner/supabase.mdx +30 -0
- package/templates/content/en/Partner/vercel.mdx +28 -0
- package/templates/content/en/PartnersList/partners.mdx +22 -0
- package/templates/content/en/Person/founder.mdx +18 -0
- package/templates/content/en/Pricing/pricing.mdx +538 -0
- package/templates/content/en/Pricing/pricing.schema.json +209 -0
- package/templates/content/en/PrivacyPage/privacy.mdx +165 -0
- package/templates/content/en/PrivacyPage/privacy.schema.json +64 -0
- package/templates/content/en/Product/ailk.mdx +19 -0
- package/templates/content/en/Product/ailk.schema.json +94 -0
- package/templates/content/en/Product/api-launch-kit.mdx +26 -0
- package/templates/content/en/Product/launch-kit.mdx +28 -0
- package/templates/content/en/ProductsList/products.mdx +26 -0
- package/templates/content/en/Project/ailk-phase-2.mdx +54 -0
- package/templates/content/en/ProjectsList/projects.mdx +25 -0
- package/templates/content/en/ResourceDetail/aeo-scoring-guide.mdx +27 -0
- package/templates/content/en/ResourceDetail/content-model-whitepaper.mdx +28 -0
- package/templates/content/en/ResourceDetail/schema-org-quick-reference.mdx +39 -0
- package/templates/content/en/ResourcesHub/resources.mdx +22 -0
- package/templates/content/en/Service/consulting.mdx +22 -0
- package/templates/content/en/Service/implementation.mdx +30 -0
- package/templates/content/en/Service/launch-service.mdx +232 -0
- package/templates/content/en/Service/launch.mdx +228 -0
- package/templates/content/en/ServicesList/services.mdx +84 -0
- package/templates/content/en/SoftwareProduct/ailk-aeo.mdx +44 -0
- package/templates/content/en/SoftwareProduct/ailk-content-adapters.mdx +47 -0
- package/templates/content/en/SoftwareProduct/ailk-schema.mdx +49 -0
- package/templates/content/en/TeamList/team.mdx +63 -0
- package/templates/content/en/TeamMember/founder.mdx +72 -0
- package/templates/content/en/TermsPage/terms.mdx +19 -0
- package/templates/content/en/TermsPage/terms.schema.json +99 -0
- package/templates/content/en/TestimonialsList/testimonials.mdx +44 -0
- package/templates/content/en/UseCasesList/use-cases.mdx +30 -0
- package/templates/content/en/Whitepaper/ax-first-product-development.mdx +27 -0
- package/templates/content/en/Whitepaper/open-core-commercial-strategy.mdx +27 -0
- package/templates/content/en/Whitepaper/structured-data-for-answer-engines.mdx +31 -0
- package/templates/content/en-XA/AboutPage/about.mdx +8 -0
- package/templates/content/en-XA/FAQPage/faq.mdx +8 -0
- package/templates/content/en-XA/HomePage/home.mdx +8 -0
- package/templates/content/es/_site.mdx +30 -0
- package/templates/content/fr/_site.mdx +30 -0
- package/templates/content/ja/_site.mdx +30 -0
- package/templates/content/pt-BR/AboutPage/about.mdx +8 -0
- package/templates/content/pt-BR/FAQPage/faq.mdx +8 -0
- package/templates/content/pt-BR/HomePage/home.mdx +23 -0
- package/templates/database/CHANGELOG.md +5 -0
- package/templates/database/README.md +234 -0
- package/templates/database/__tests__/user-cascade.test.ts +125 -0
- package/templates/database/auth/.gitkeep +0 -0
- package/templates/database/config/.gitkeep +0 -0
- package/templates/database/content/.gitkeep +0 -0
- package/templates/database/inbox/.gitkeep +0 -0
- package/templates/database/inbox/README.md +3 -0
- package/templates/database/inbox/__tests__/schema.test.ts +40 -0
- package/templates/database/inbox/schema.prisma +52 -0
- package/templates/database/jest.config.cjs +29 -0
- package/templates/database/migrations/20260508000000_add_inbox_namespace/migration.sql +328 -0
- package/templates/database/migrations/20260513000000_better_auth_migration/migration.sql +100 -0
- package/templates/database/migrations/20260515000000_add_user_billing_fields/migration.sql +28 -0
- package/templates/database/migrations/20260516000000_add_user_tier_care_plan_seat/migration.sql +25 -0
- package/templates/database/migrations/20260518000000_add_telemetry_records/migration.sql +42 -0
- package/templates/database/migrations/20260525000000_theme_wiring/migration.sql +67 -0
- package/templates/database/migrations/20260710000000_retire_commercial_tier/migration.sql +21 -0
- package/templates/database/migrations/migration_lock.toml +3 -0
- package/templates/database/ops/.gitkeep +0 -0
- package/templates/database/package.json +45 -0
- package/templates/database/prisma.config.ts +20 -0
- package/templates/database/schema.prisma +487 -0
- package/templates/database/scripts/db-generate-locked.sh +80 -0
- package/templates/database/seed-test.ts +85 -0
- package/templates/database/tsconfig.build.json +16 -0
- package/templates/database/tsconfig.json +9 -0
- package/templates/package.json +125 -0
- package/templates/pnpm-workspace.yaml +6 -0
- package/templates/project.yaml +59 -0
- package/templates/tsconfig.base.json +18 -0
- package/templates/tsconfig.json +45 -0
|
@@ -0,0 +1,844 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Phase 2 Standalone Informational routes — HowTo, TechArticle, Whitepaper,
|
|
3
|
+
* SoftwareProduct (list + detail), and Careers (CareersList list + JobPosting detail).
|
|
4
|
+
*
|
|
5
|
+
* Pattern mirrors products-services-phase1.test.tsx:
|
|
6
|
+
* - List pages: getMdxSlugs injected via optional prop (how-to/tech-articles/
|
|
7
|
+
* whitepapers/software) or getMdxSource injected via optional prop (careers).
|
|
8
|
+
* - Detail pages: getMdxSource injected via optional prop; notFound() mocked.
|
|
9
|
+
* - generateStaticParams: getMdxSlugs mocked at module level (narrowest scope —
|
|
10
|
+
* Next.js fixed function signature, DI not available there).
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import { render, screen } from "@testing-library/react";
|
|
14
|
+
|
|
15
|
+
jest.mock("next-mdx-remote/rsc", () => ({
|
|
16
|
+
__esModule: true,
|
|
17
|
+
MDXRemote: ({ source }: { source: string }): React.ReactElement => (
|
|
18
|
+
<div data-testid="mdx-rendered">{source}</div>
|
|
19
|
+
),
|
|
20
|
+
}));
|
|
21
|
+
|
|
22
|
+
jest.mock("next/navigation", () => ({
|
|
23
|
+
__esModule: true,
|
|
24
|
+
notFound: jest.fn(() => {
|
|
25
|
+
throw new Error("NEXT_NOT_FOUND");
|
|
26
|
+
}),
|
|
27
|
+
}));
|
|
28
|
+
|
|
29
|
+
// Careers, how-to, tech-articles, whitepapers, software routes all migrated to
|
|
30
|
+
// @working-theory/page-renderer; mock getMdxSlugs for generateStaticParams.
|
|
31
|
+
jest.mock("@working-theory/page-renderer", () => {
|
|
32
|
+
const actual = jest.requireActual("@working-theory/page-renderer") as Record<string, unknown>;
|
|
33
|
+
return { ...actual, getMdxSlugs: jest.fn() };
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
import * as React from "react";
|
|
37
|
+
|
|
38
|
+
import { getMdxSlugs as getPageRendererMdxSlugs } from "@working-theory/page-renderer";
|
|
39
|
+
import { notFound } from "next/navigation";
|
|
40
|
+
|
|
41
|
+
import HowToPage from "../app/[locale]/how-to/page";
|
|
42
|
+
import HowToSlugPage, {
|
|
43
|
+
generateStaticParams as howToStaticParams,
|
|
44
|
+
} from "../app/[locale]/how-to/[slug]/page";
|
|
45
|
+
import TechArticlesPage from "../app/[locale]/tech-articles/page";
|
|
46
|
+
import TechArticleSlugPage, {
|
|
47
|
+
generateStaticParams as techArticleStaticParams,
|
|
48
|
+
} from "../app/[locale]/tech-articles/[slug]/page";
|
|
49
|
+
import WhitepapersPage from "../app/[locale]/whitepapers/page";
|
|
50
|
+
import WhitepaperSlugPage, {
|
|
51
|
+
generateStaticParams as whitepaperStaticParams,
|
|
52
|
+
} from "../app/[locale]/whitepapers/[slug]/page";
|
|
53
|
+
import SoftwarePage from "../app/[locale]/software/page";
|
|
54
|
+
import SoftwareSlugPage, {
|
|
55
|
+
generateStaticParams as softwareStaticParams,
|
|
56
|
+
} from "../app/[locale]/software/[slug]/page";
|
|
57
|
+
import CareersPage from "../app/[locale]/careers/page";
|
|
58
|
+
import CareersSlugPage, {
|
|
59
|
+
generateStaticParams as careersSlugStaticParams,
|
|
60
|
+
} from "../app/[locale]/careers/[slug]/page";
|
|
61
|
+
|
|
62
|
+
import type {
|
|
63
|
+
getMdxSource,
|
|
64
|
+
getMdxSlugs as getMdxSlugsType,
|
|
65
|
+
} from "@working-theory/page-renderer";
|
|
66
|
+
|
|
67
|
+
type GetMdxSource = typeof getMdxSource;
|
|
68
|
+
type GetMdxSlugs = typeof getMdxSlugsType;
|
|
69
|
+
|
|
70
|
+
const mockPageRendererGetMdxSlugs = getPageRendererMdxSlugs as jest.MockedFunction<typeof getPageRendererMdxSlugs>;
|
|
71
|
+
const mockNotFound = notFound as jest.MockedFunction<typeof notFound>;
|
|
72
|
+
|
|
73
|
+
async function renderAsync(
|
|
74
|
+
element: Promise<React.ReactElement> | React.ReactElement,
|
|
75
|
+
): Promise<void> {
|
|
76
|
+
const resolved = await element;
|
|
77
|
+
render(resolved);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
describe("apps/web — Phase 2: Standalone Informational routes", () => {
|
|
81
|
+
beforeEach(() => {
|
|
82
|
+
mockPageRendererGetMdxSlugs.mockReset();
|
|
83
|
+
mockNotFound.mockClear();
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
// ── /how-to (list) ────────────────────────────────────────────────────────
|
|
87
|
+
|
|
88
|
+
describe("/how-to", () => {
|
|
89
|
+
describe("with seeded HowTo slugs", () => {
|
|
90
|
+
const stubGetMdxSlugs = jest
|
|
91
|
+
.fn<ReturnType<GetMdxSlugs>, Parameters<GetMdxSlugs>>()
|
|
92
|
+
.mockResolvedValue(["set-up-json-ld", "add-mdx-content"]);
|
|
93
|
+
|
|
94
|
+
beforeEach(() => stubGetMdxSlugs.mockClear());
|
|
95
|
+
|
|
96
|
+
it("renders the h1", async () => {
|
|
97
|
+
await renderAsync(
|
|
98
|
+
HowToPage({
|
|
99
|
+
params: Promise.resolve({ locale: "en" }),
|
|
100
|
+
getMdxSlugs: stubGetMdxSlugs,
|
|
101
|
+
}),
|
|
102
|
+
);
|
|
103
|
+
expect(screen.getByRole("heading", { level: 1 })).toHaveTextContent(
|
|
104
|
+
"How-To Guides",
|
|
105
|
+
);
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
it("renders links for each slug", async () => {
|
|
109
|
+
await renderAsync(
|
|
110
|
+
HowToPage({
|
|
111
|
+
params: Promise.resolve({ locale: "en" }),
|
|
112
|
+
getMdxSlugs: stubGetMdxSlugs,
|
|
113
|
+
}),
|
|
114
|
+
);
|
|
115
|
+
expect(screen.getByTestId("how-to-list")).toBeInTheDocument();
|
|
116
|
+
expect(screen.getAllByRole("link")).toHaveLength(2);
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
it("calls getMdxSlugs with HowTo type and locale", async () => {
|
|
120
|
+
await renderAsync(
|
|
121
|
+
HowToPage({
|
|
122
|
+
params: Promise.resolve({ locale: "en" }),
|
|
123
|
+
getMdxSlugs: stubGetMdxSlugs,
|
|
124
|
+
}),
|
|
125
|
+
);
|
|
126
|
+
expect(stubGetMdxSlugs).toHaveBeenCalledWith("HowTo", "en");
|
|
127
|
+
});
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
describe("with no HowTo slugs (empty state)", () => {
|
|
131
|
+
const stubGetMdxSlugs = jest
|
|
132
|
+
.fn<ReturnType<GetMdxSlugs>, Parameters<GetMdxSlugs>>()
|
|
133
|
+
.mockResolvedValue([]);
|
|
134
|
+
|
|
135
|
+
it("renders the fallback sentinel", async () => {
|
|
136
|
+
await renderAsync(
|
|
137
|
+
HowToPage({
|
|
138
|
+
params: Promise.resolve({ locale: "en" }),
|
|
139
|
+
getMdxSlugs: stubGetMdxSlugs,
|
|
140
|
+
}),
|
|
141
|
+
);
|
|
142
|
+
expect(screen.getByTestId("section-empty-state")).toBeInTheDocument();
|
|
143
|
+
});
|
|
144
|
+
});
|
|
145
|
+
});
|
|
146
|
+
|
|
147
|
+
// ── /how-to/[slug] (detail) ───────────────────────────────────────────────
|
|
148
|
+
|
|
149
|
+
describe("/how-to/[slug]", () => {
|
|
150
|
+
describe("with HowTo MDX present", () => {
|
|
151
|
+
const stubGetMdxSource = jest
|
|
152
|
+
.fn<ReturnType<GetMdxSource>, Parameters<GetMdxSource>>()
|
|
153
|
+
.mockResolvedValue({
|
|
154
|
+
frontmatter: {
|
|
155
|
+
type: "HowTo",
|
|
156
|
+
slug: "set-up-json-ld",
|
|
157
|
+
title: "How to Set Up JSON-LD",
|
|
158
|
+
description: "A step-by-step guide.",
|
|
159
|
+
},
|
|
160
|
+
body: "# How to Set Up JSON-LD\n\nBody.",
|
|
161
|
+
});
|
|
162
|
+
|
|
163
|
+
beforeEach(() => stubGetMdxSource.mockClear());
|
|
164
|
+
|
|
165
|
+
it("renders the h1 from frontmatter", async () => {
|
|
166
|
+
await renderAsync(
|
|
167
|
+
HowToSlugPage({
|
|
168
|
+
params: Promise.resolve({ locale: "en", slug: "set-up-json-ld" }),
|
|
169
|
+
getMdxSource: stubGetMdxSource,
|
|
170
|
+
}),
|
|
171
|
+
);
|
|
172
|
+
expect(screen.getByRole("heading", { level: 1 })).toHaveTextContent(
|
|
173
|
+
"How to Set Up JSON-LD",
|
|
174
|
+
);
|
|
175
|
+
});
|
|
176
|
+
|
|
177
|
+
it("emits a JSON-LD script tag with @type HowTo", async () => {
|
|
178
|
+
await renderAsync(
|
|
179
|
+
HowToSlugPage({
|
|
180
|
+
params: Promise.resolve({ locale: "en", slug: "set-up-json-ld" }),
|
|
181
|
+
getMdxSource: stubGetMdxSource,
|
|
182
|
+
}),
|
|
183
|
+
);
|
|
184
|
+
const script = screen.getByTestId("json-ld");
|
|
185
|
+
const outer = JSON.parse(script.innerHTML) as { "@type": string; "@graph": Array<{ "@type": string; mainEntity: { "@type": string } }> };
|
|
186
|
+
expect(outer["@type"]).toBeUndefined();
|
|
187
|
+
const primary = outer["@graph"][0]!;
|
|
188
|
+
expect(primary["@type"]).toBe("WebPage");
|
|
189
|
+
expect(primary.mainEntity["@type"]).toBe("HowTo");
|
|
190
|
+
});
|
|
191
|
+
|
|
192
|
+
it("renders the MDX body", async () => {
|
|
193
|
+
await renderAsync(
|
|
194
|
+
HowToSlugPage({
|
|
195
|
+
params: Promise.resolve({ locale: "en", slug: "set-up-json-ld" }),
|
|
196
|
+
getMdxSource: stubGetMdxSource,
|
|
197
|
+
}),
|
|
198
|
+
);
|
|
199
|
+
expect(screen.getByTestId("mdx-body")).toBeInTheDocument();
|
|
200
|
+
});
|
|
201
|
+
});
|
|
202
|
+
|
|
203
|
+
describe("with no HowTo MDX (unknown slug)", () => {
|
|
204
|
+
const stubGetMdxSource = jest
|
|
205
|
+
.fn<ReturnType<GetMdxSource>, Parameters<GetMdxSource>>()
|
|
206
|
+
.mockResolvedValue(null);
|
|
207
|
+
|
|
208
|
+
it("calls notFound() for an unknown slug", async () => {
|
|
209
|
+
await expect(
|
|
210
|
+
HowToSlugPage({
|
|
211
|
+
params: Promise.resolve({ locale: "en", slug: "unknown" }),
|
|
212
|
+
getMdxSource: stubGetMdxSource,
|
|
213
|
+
}),
|
|
214
|
+
).rejects.toThrow("NEXT_NOT_FOUND");
|
|
215
|
+
expect(mockNotFound).toHaveBeenCalled();
|
|
216
|
+
});
|
|
217
|
+
});
|
|
218
|
+
});
|
|
219
|
+
|
|
220
|
+
// ── /tech-articles (list) ─────────────────────────────────────────────────
|
|
221
|
+
|
|
222
|
+
describe("/tech-articles", () => {
|
|
223
|
+
describe("with seeded TechArticle slugs", () => {
|
|
224
|
+
const stubGetMdxSlugs = jest
|
|
225
|
+
.fn<ReturnType<GetMdxSlugs>, Parameters<GetMdxSlugs>>()
|
|
226
|
+
.mockResolvedValue([
|
|
227
|
+
"json-ld-architecture",
|
|
228
|
+
"content-adapter-internals",
|
|
229
|
+
]);
|
|
230
|
+
|
|
231
|
+
it("renders the h1", async () => {
|
|
232
|
+
await renderAsync(
|
|
233
|
+
TechArticlesPage({
|
|
234
|
+
params: Promise.resolve({ locale: "en" }),
|
|
235
|
+
getMdxSlugs: stubGetMdxSlugs,
|
|
236
|
+
}),
|
|
237
|
+
);
|
|
238
|
+
expect(screen.getByRole("heading", { level: 1 })).toHaveTextContent(
|
|
239
|
+
"Technical Articles",
|
|
240
|
+
);
|
|
241
|
+
});
|
|
242
|
+
|
|
243
|
+
it("renders links for each slug", async () => {
|
|
244
|
+
await renderAsync(
|
|
245
|
+
TechArticlesPage({
|
|
246
|
+
params: Promise.resolve({ locale: "en" }),
|
|
247
|
+
getMdxSlugs: stubGetMdxSlugs,
|
|
248
|
+
}),
|
|
249
|
+
);
|
|
250
|
+
expect(screen.getAllByRole("link")).toHaveLength(2);
|
|
251
|
+
});
|
|
252
|
+
|
|
253
|
+
it("calls getMdxSlugs with TechArticle type and locale", async () => {
|
|
254
|
+
await renderAsync(
|
|
255
|
+
TechArticlesPage({
|
|
256
|
+
params: Promise.resolve({ locale: "en" }),
|
|
257
|
+
getMdxSlugs: stubGetMdxSlugs,
|
|
258
|
+
}),
|
|
259
|
+
);
|
|
260
|
+
expect(stubGetMdxSlugs).toHaveBeenCalledWith("TechArticle", "en");
|
|
261
|
+
});
|
|
262
|
+
});
|
|
263
|
+
|
|
264
|
+
describe("with no TechArticle slugs (empty state)", () => {
|
|
265
|
+
const stubGetMdxSlugs = jest
|
|
266
|
+
.fn<ReturnType<GetMdxSlugs>, Parameters<GetMdxSlugs>>()
|
|
267
|
+
.mockResolvedValue([]);
|
|
268
|
+
|
|
269
|
+
it("renders the fallback sentinel", async () => {
|
|
270
|
+
await renderAsync(
|
|
271
|
+
TechArticlesPage({
|
|
272
|
+
params: Promise.resolve({ locale: "en" }),
|
|
273
|
+
getMdxSlugs: stubGetMdxSlugs,
|
|
274
|
+
}),
|
|
275
|
+
);
|
|
276
|
+
expect(screen.getByTestId("section-empty-state")).toBeInTheDocument();
|
|
277
|
+
});
|
|
278
|
+
});
|
|
279
|
+
});
|
|
280
|
+
|
|
281
|
+
// ── /tech-articles/[slug] (detail) ────────────────────────────────────────
|
|
282
|
+
|
|
283
|
+
describe("/tech-articles/[slug]", () => {
|
|
284
|
+
describe("with TechArticle MDX present", () => {
|
|
285
|
+
const stubGetMdxSource = jest
|
|
286
|
+
.fn<ReturnType<GetMdxSource>, Parameters<GetMdxSource>>()
|
|
287
|
+
.mockResolvedValue({
|
|
288
|
+
frontmatter: {
|
|
289
|
+
type: "TechArticle",
|
|
290
|
+
slug: "json-ld-architecture",
|
|
291
|
+
title: "JSON-LD Architecture in AI Launch Kit",
|
|
292
|
+
description: "A technical deep-dive.",
|
|
293
|
+
},
|
|
294
|
+
body: "# JSON-LD Architecture\n\nBody.",
|
|
295
|
+
});
|
|
296
|
+
|
|
297
|
+
it("renders the h1 from frontmatter", async () => {
|
|
298
|
+
await renderAsync(
|
|
299
|
+
TechArticleSlugPage({
|
|
300
|
+
params: Promise.resolve({
|
|
301
|
+
locale: "en",
|
|
302
|
+
slug: "json-ld-architecture",
|
|
303
|
+
}),
|
|
304
|
+
getMdxSource: stubGetMdxSource,
|
|
305
|
+
}),
|
|
306
|
+
);
|
|
307
|
+
expect(screen.getByRole("heading", { level: 1 })).toHaveTextContent(
|
|
308
|
+
"JSON-LD Architecture in AI Launch Kit",
|
|
309
|
+
);
|
|
310
|
+
});
|
|
311
|
+
|
|
312
|
+
it("emits a JSON-LD script tag with @type TechArticle", async () => {
|
|
313
|
+
await renderAsync(
|
|
314
|
+
TechArticleSlugPage({
|
|
315
|
+
params: Promise.resolve({
|
|
316
|
+
locale: "en",
|
|
317
|
+
slug: "json-ld-architecture",
|
|
318
|
+
}),
|
|
319
|
+
getMdxSource: stubGetMdxSource,
|
|
320
|
+
}),
|
|
321
|
+
);
|
|
322
|
+
const script = screen.getByTestId("json-ld");
|
|
323
|
+
const outer = JSON.parse(script.innerHTML) as { "@type": string; "@graph": Array<{ "@type": string; mainEntity: { "@type": string } }> };
|
|
324
|
+
expect(outer["@type"]).toBeUndefined();
|
|
325
|
+
const primary = outer["@graph"][0]!;
|
|
326
|
+
expect(primary["@type"]).toBe("WebPage");
|
|
327
|
+
expect(primary.mainEntity["@type"]).toBe("TechArticle");
|
|
328
|
+
});
|
|
329
|
+
});
|
|
330
|
+
|
|
331
|
+
describe("with no TechArticle MDX (unknown slug)", () => {
|
|
332
|
+
const stubGetMdxSource = jest
|
|
333
|
+
.fn<ReturnType<GetMdxSource>, Parameters<GetMdxSource>>()
|
|
334
|
+
.mockResolvedValue(null);
|
|
335
|
+
|
|
336
|
+
it("calls notFound() for an unknown slug", async () => {
|
|
337
|
+
await expect(
|
|
338
|
+
TechArticleSlugPage({
|
|
339
|
+
params: Promise.resolve({ locale: "en", slug: "unknown" }),
|
|
340
|
+
getMdxSource: stubGetMdxSource,
|
|
341
|
+
}),
|
|
342
|
+
).rejects.toThrow("NEXT_NOT_FOUND");
|
|
343
|
+
expect(mockNotFound).toHaveBeenCalled();
|
|
344
|
+
});
|
|
345
|
+
});
|
|
346
|
+
});
|
|
347
|
+
|
|
348
|
+
// ── /whitepapers (list) ───────────────────────────────────────────────────
|
|
349
|
+
|
|
350
|
+
describe("/whitepapers", () => {
|
|
351
|
+
describe("with seeded Whitepaper slugs", () => {
|
|
352
|
+
const stubGetMdxSlugs = jest
|
|
353
|
+
.fn<ReturnType<GetMdxSlugs>, Parameters<GetMdxSlugs>>()
|
|
354
|
+
.mockResolvedValue([
|
|
355
|
+
"ax-first-product-development",
|
|
356
|
+
"structured-data-for-answer-engines",
|
|
357
|
+
]);
|
|
358
|
+
|
|
359
|
+
it("renders the h1", async () => {
|
|
360
|
+
await renderAsync(
|
|
361
|
+
WhitepapersPage({
|
|
362
|
+
params: Promise.resolve({ locale: "en" }),
|
|
363
|
+
getMdxSlugs: stubGetMdxSlugs,
|
|
364
|
+
}),
|
|
365
|
+
);
|
|
366
|
+
expect(screen.getByRole("heading", { level: 1 })).toHaveTextContent(
|
|
367
|
+
"Whitepapers",
|
|
368
|
+
);
|
|
369
|
+
});
|
|
370
|
+
|
|
371
|
+
it("renders links for each slug", async () => {
|
|
372
|
+
await renderAsync(
|
|
373
|
+
WhitepapersPage({
|
|
374
|
+
params: Promise.resolve({ locale: "en" }),
|
|
375
|
+
getMdxSlugs: stubGetMdxSlugs,
|
|
376
|
+
}),
|
|
377
|
+
);
|
|
378
|
+
expect(screen.getAllByRole("link")).toHaveLength(2);
|
|
379
|
+
});
|
|
380
|
+
|
|
381
|
+
it("calls getMdxSlugs with Whitepaper type and locale", async () => {
|
|
382
|
+
await renderAsync(
|
|
383
|
+
WhitepapersPage({
|
|
384
|
+
params: Promise.resolve({ locale: "en" }),
|
|
385
|
+
getMdxSlugs: stubGetMdxSlugs,
|
|
386
|
+
}),
|
|
387
|
+
);
|
|
388
|
+
expect(stubGetMdxSlugs).toHaveBeenCalledWith("Whitepaper", "en");
|
|
389
|
+
});
|
|
390
|
+
});
|
|
391
|
+
|
|
392
|
+
describe("with no Whitepaper slugs (empty state)", () => {
|
|
393
|
+
const stubGetMdxSlugs = jest
|
|
394
|
+
.fn<ReturnType<GetMdxSlugs>, Parameters<GetMdxSlugs>>()
|
|
395
|
+
.mockResolvedValue([]);
|
|
396
|
+
|
|
397
|
+
it("renders the fallback sentinel", async () => {
|
|
398
|
+
await renderAsync(
|
|
399
|
+
WhitepapersPage({
|
|
400
|
+
params: Promise.resolve({ locale: "en" }),
|
|
401
|
+
getMdxSlugs: stubGetMdxSlugs,
|
|
402
|
+
}),
|
|
403
|
+
);
|
|
404
|
+
expect(screen.getByTestId("section-empty-state")).toBeInTheDocument();
|
|
405
|
+
});
|
|
406
|
+
});
|
|
407
|
+
});
|
|
408
|
+
|
|
409
|
+
// ── /whitepapers/[slug] (detail) ──────────────────────────────────────────
|
|
410
|
+
|
|
411
|
+
describe("/whitepapers/[slug]", () => {
|
|
412
|
+
describe("with Whitepaper MDX present", () => {
|
|
413
|
+
const stubGetMdxSource = jest
|
|
414
|
+
.fn<ReturnType<GetMdxSource>, Parameters<GetMdxSource>>()
|
|
415
|
+
.mockResolvedValue({
|
|
416
|
+
frontmatter: {
|
|
417
|
+
type: "Whitepaper",
|
|
418
|
+
slug: "ax-first-product-development",
|
|
419
|
+
title: "AX-First Product Development",
|
|
420
|
+
description:
|
|
421
|
+
"Why treating the API and MCP server as first-class surfaces matters.",
|
|
422
|
+
},
|
|
423
|
+
body: "# AX-First Product Development\n\nBody.",
|
|
424
|
+
});
|
|
425
|
+
|
|
426
|
+
it("renders the h1 from frontmatter", async () => {
|
|
427
|
+
await renderAsync(
|
|
428
|
+
WhitepaperSlugPage({
|
|
429
|
+
params: Promise.resolve({
|
|
430
|
+
locale: "en",
|
|
431
|
+
slug: "ax-first-product-development",
|
|
432
|
+
}),
|
|
433
|
+
getMdxSource: stubGetMdxSource,
|
|
434
|
+
}),
|
|
435
|
+
);
|
|
436
|
+
expect(screen.getByRole("heading", { level: 1 })).toHaveTextContent(
|
|
437
|
+
"AX-First Product Development",
|
|
438
|
+
);
|
|
439
|
+
});
|
|
440
|
+
|
|
441
|
+
it("emits a JSON-LD script tag with @type Article", async () => {
|
|
442
|
+
await renderAsync(
|
|
443
|
+
WhitepaperSlugPage({
|
|
444
|
+
params: Promise.resolve({
|
|
445
|
+
locale: "en",
|
|
446
|
+
slug: "ax-first-product-development",
|
|
447
|
+
}),
|
|
448
|
+
getMdxSource: stubGetMdxSource,
|
|
449
|
+
}),
|
|
450
|
+
);
|
|
451
|
+
const script = screen.getByTestId("json-ld");
|
|
452
|
+
const outer = JSON.parse(script.innerHTML) as { "@type": string; "@graph": Array<{ "@type": string; mainEntity: { "@type": string } }> };
|
|
453
|
+
expect(outer["@type"]).toBeUndefined();
|
|
454
|
+
const primary = outer["@graph"][0]!;
|
|
455
|
+
expect(primary["@type"]).toBe("WebPage");
|
|
456
|
+
expect(primary.mainEntity["@type"]).toBe("Article");
|
|
457
|
+
});
|
|
458
|
+
});
|
|
459
|
+
|
|
460
|
+
describe("with no Whitepaper MDX (unknown slug)", () => {
|
|
461
|
+
const stubGetMdxSource = jest
|
|
462
|
+
.fn<ReturnType<GetMdxSource>, Parameters<GetMdxSource>>()
|
|
463
|
+
.mockResolvedValue(null);
|
|
464
|
+
|
|
465
|
+
it("calls notFound() for an unknown slug", async () => {
|
|
466
|
+
await expect(
|
|
467
|
+
WhitepaperSlugPage({
|
|
468
|
+
params: Promise.resolve({ locale: "en", slug: "unknown" }),
|
|
469
|
+
getMdxSource: stubGetMdxSource,
|
|
470
|
+
}),
|
|
471
|
+
).rejects.toThrow("NEXT_NOT_FOUND");
|
|
472
|
+
expect(mockNotFound).toHaveBeenCalled();
|
|
473
|
+
});
|
|
474
|
+
});
|
|
475
|
+
});
|
|
476
|
+
|
|
477
|
+
// ── /software (list) ──────────────────────────────────────────────────────
|
|
478
|
+
|
|
479
|
+
describe("/software", () => {
|
|
480
|
+
describe("with seeded SoftwareProduct slugs", () => {
|
|
481
|
+
const stubGetMdxSlugs = jest
|
|
482
|
+
.fn<ReturnType<GetMdxSlugs>, Parameters<GetMdxSlugs>>()
|
|
483
|
+
.mockResolvedValue(["ailk-schema", "ailk-aeo"]);
|
|
484
|
+
|
|
485
|
+
it("renders the h1", async () => {
|
|
486
|
+
await renderAsync(
|
|
487
|
+
SoftwarePage({
|
|
488
|
+
params: Promise.resolve({ locale: "en" }),
|
|
489
|
+
getMdxSlugs: stubGetMdxSlugs,
|
|
490
|
+
}),
|
|
491
|
+
);
|
|
492
|
+
expect(screen.getByRole("heading", { level: 1 })).toHaveTextContent(
|
|
493
|
+
"Software",
|
|
494
|
+
);
|
|
495
|
+
});
|
|
496
|
+
|
|
497
|
+
it("renders links for each slug", async () => {
|
|
498
|
+
await renderAsync(
|
|
499
|
+
SoftwarePage({
|
|
500
|
+
params: Promise.resolve({ locale: "en" }),
|
|
501
|
+
getMdxSlugs: stubGetMdxSlugs,
|
|
502
|
+
}),
|
|
503
|
+
);
|
|
504
|
+
expect(screen.getAllByRole("link")).toHaveLength(2);
|
|
505
|
+
});
|
|
506
|
+
|
|
507
|
+
it("calls getMdxSlugs with SoftwareProduct type and locale", async () => {
|
|
508
|
+
await renderAsync(
|
|
509
|
+
SoftwarePage({
|
|
510
|
+
params: Promise.resolve({ locale: "en" }),
|
|
511
|
+
getMdxSlugs: stubGetMdxSlugs,
|
|
512
|
+
}),
|
|
513
|
+
);
|
|
514
|
+
expect(stubGetMdxSlugs).toHaveBeenCalledWith("SoftwareProduct", "en");
|
|
515
|
+
});
|
|
516
|
+
});
|
|
517
|
+
|
|
518
|
+
describe("with no SoftwareProduct slugs (empty state)", () => {
|
|
519
|
+
const stubGetMdxSlugs = jest
|
|
520
|
+
.fn<ReturnType<GetMdxSlugs>, Parameters<GetMdxSlugs>>()
|
|
521
|
+
.mockResolvedValue([]);
|
|
522
|
+
|
|
523
|
+
it("renders the fallback sentinel", async () => {
|
|
524
|
+
await renderAsync(
|
|
525
|
+
SoftwarePage({
|
|
526
|
+
params: Promise.resolve({ locale: "en" }),
|
|
527
|
+
getMdxSlugs: stubGetMdxSlugs,
|
|
528
|
+
}),
|
|
529
|
+
);
|
|
530
|
+
expect(screen.getByTestId("section-empty-state")).toBeInTheDocument();
|
|
531
|
+
});
|
|
532
|
+
});
|
|
533
|
+
});
|
|
534
|
+
|
|
535
|
+
// ── /software/[slug] (detail) ─────────────────────────────────────────────
|
|
536
|
+
|
|
537
|
+
describe("/software/[slug]", () => {
|
|
538
|
+
describe("with SoftwareProduct MDX present", () => {
|
|
539
|
+
const stubGetMdxSource = jest
|
|
540
|
+
.fn<ReturnType<GetMdxSource>, Parameters<GetMdxSource>>()
|
|
541
|
+
.mockResolvedValue({
|
|
542
|
+
frontmatter: {
|
|
543
|
+
type: "SoftwareProduct",
|
|
544
|
+
slug: "ailk-schema",
|
|
545
|
+
title: "@working-theory/schema — JSON-LD Builders",
|
|
546
|
+
description:
|
|
547
|
+
"Typed schema.org JSON-LD builders for all 45 AILK page types.",
|
|
548
|
+
},
|
|
549
|
+
body: "# @working-theory/schema\n\nBody.",
|
|
550
|
+
});
|
|
551
|
+
|
|
552
|
+
it("renders the h1 from frontmatter", async () => {
|
|
553
|
+
await renderAsync(
|
|
554
|
+
SoftwareSlugPage({
|
|
555
|
+
params: Promise.resolve({ locale: "en", slug: "ailk-schema" }),
|
|
556
|
+
getMdxSource: stubGetMdxSource,
|
|
557
|
+
}),
|
|
558
|
+
);
|
|
559
|
+
expect(screen.getByRole("heading", { level: 1 })).toHaveTextContent(
|
|
560
|
+
"@working-theory/schema — JSON-LD Builders",
|
|
561
|
+
);
|
|
562
|
+
});
|
|
563
|
+
|
|
564
|
+
it("emits a JSON-LD script tag with @type WebPage", async () => {
|
|
565
|
+
await renderAsync(
|
|
566
|
+
SoftwareSlugPage({
|
|
567
|
+
params: Promise.resolve({ locale: "en", slug: "ailk-schema" }),
|
|
568
|
+
getMdxSource: stubGetMdxSource,
|
|
569
|
+
}),
|
|
570
|
+
);
|
|
571
|
+
const script = screen.getByTestId("json-ld");
|
|
572
|
+
const parsed = JSON.parse(script.innerHTML) as { "@type": string };
|
|
573
|
+
expect(parsed["@type"]).toBe("WebPage");
|
|
574
|
+
});
|
|
575
|
+
});
|
|
576
|
+
|
|
577
|
+
describe("with no SoftwareProduct MDX (unknown slug)", () => {
|
|
578
|
+
const stubGetMdxSource = jest
|
|
579
|
+
.fn<ReturnType<GetMdxSource>, Parameters<GetMdxSource>>()
|
|
580
|
+
.mockResolvedValue(null);
|
|
581
|
+
|
|
582
|
+
it("calls notFound() for an unknown slug", async () => {
|
|
583
|
+
await expect(
|
|
584
|
+
SoftwareSlugPage({
|
|
585
|
+
params: Promise.resolve({ locale: "en", slug: "unknown" }),
|
|
586
|
+
getMdxSource: stubGetMdxSource,
|
|
587
|
+
}),
|
|
588
|
+
).rejects.toThrow("NEXT_NOT_FOUND");
|
|
589
|
+
expect(mockNotFound).toHaveBeenCalled();
|
|
590
|
+
});
|
|
591
|
+
});
|
|
592
|
+
});
|
|
593
|
+
|
|
594
|
+
// ── /careers (list — CareersList) ─────────────────────────────────────────
|
|
595
|
+
|
|
596
|
+
describe("/careers", () => {
|
|
597
|
+
describe("with CareersList MDX present", () => {
|
|
598
|
+
const stubGetMdxSource = jest
|
|
599
|
+
.fn<ReturnType<GetMdxSource>, Parameters<GetMdxSource>>()
|
|
600
|
+
.mockResolvedValue({
|
|
601
|
+
frontmatter: {
|
|
602
|
+
type: "CareersList",
|
|
603
|
+
slug: "careers",
|
|
604
|
+
title: "Careers at AI Launch Kit",
|
|
605
|
+
description:
|
|
606
|
+
"Join the team building the infrastructure layer for human-agent products.",
|
|
607
|
+
},
|
|
608
|
+
body: "# Careers\n\nBody.",
|
|
609
|
+
});
|
|
610
|
+
|
|
611
|
+
beforeEach(() => stubGetMdxSource.mockClear());
|
|
612
|
+
|
|
613
|
+
it("renders the h1 from frontmatter", async () => {
|
|
614
|
+
await renderAsync(
|
|
615
|
+
CareersPage({
|
|
616
|
+
params: Promise.resolve({ locale: "en" }),
|
|
617
|
+
getMdxSource: stubGetMdxSource,
|
|
618
|
+
}),
|
|
619
|
+
);
|
|
620
|
+
expect(screen.getByRole("heading", { level: 1 })).toHaveTextContent(
|
|
621
|
+
"Careers at AI Launch Kit",
|
|
622
|
+
);
|
|
623
|
+
});
|
|
624
|
+
|
|
625
|
+
it("emits a JSON-LD script tag with @type CollectionPage", async () => {
|
|
626
|
+
await renderAsync(
|
|
627
|
+
CareersPage({
|
|
628
|
+
params: Promise.resolve({ locale: "en" }),
|
|
629
|
+
getMdxSource: stubGetMdxSource,
|
|
630
|
+
}),
|
|
631
|
+
);
|
|
632
|
+
const script = screen.getByTestId("json-ld");
|
|
633
|
+
const parsed = JSON.parse(script.innerHTML) as { "@type": string };
|
|
634
|
+
expect(parsed["@type"]).toBe("CollectionPage");
|
|
635
|
+
});
|
|
636
|
+
|
|
637
|
+
it("calls getMdxSource with CareersList type and locale", async () => {
|
|
638
|
+
await renderAsync(
|
|
639
|
+
CareersPage({
|
|
640
|
+
params: Promise.resolve({ locale: "en" }),
|
|
641
|
+
getMdxSource: stubGetMdxSource,
|
|
642
|
+
}),
|
|
643
|
+
);
|
|
644
|
+
expect(stubGetMdxSource).toHaveBeenCalledWith(
|
|
645
|
+
"CareersList",
|
|
646
|
+
"careers",
|
|
647
|
+
"en",
|
|
648
|
+
);
|
|
649
|
+
});
|
|
650
|
+
|
|
651
|
+
it("renders the MDX body", async () => {
|
|
652
|
+
await renderAsync(
|
|
653
|
+
CareersPage({
|
|
654
|
+
params: Promise.resolve({ locale: "en" }),
|
|
655
|
+
getMdxSource: stubGetMdxSource,
|
|
656
|
+
}),
|
|
657
|
+
);
|
|
658
|
+
expect(screen.getByTestId("mdx-body")).toBeInTheDocument();
|
|
659
|
+
});
|
|
660
|
+
});
|
|
661
|
+
|
|
662
|
+
describe("with no CareersList MDX (empty state)", () => {
|
|
663
|
+
const stubGetMdxSource = jest
|
|
664
|
+
.fn<ReturnType<GetMdxSource>, Parameters<GetMdxSource>>()
|
|
665
|
+
.mockResolvedValue(null);
|
|
666
|
+
|
|
667
|
+
it("renders the fallback sentinel without crashing", async () => {
|
|
668
|
+
await renderAsync(
|
|
669
|
+
CareersPage({
|
|
670
|
+
params: Promise.resolve({ locale: "en" }),
|
|
671
|
+
getMdxSource: stubGetMdxSource,
|
|
672
|
+
}),
|
|
673
|
+
);
|
|
674
|
+
expect(screen.getByTestId("section-empty-state")).toBeInTheDocument();
|
|
675
|
+
});
|
|
676
|
+
});
|
|
677
|
+
});
|
|
678
|
+
|
|
679
|
+
// ── /careers/[slug] (detail — JobPosting) ────────────────────────────────
|
|
680
|
+
|
|
681
|
+
describe("/careers/[slug]", () => {
|
|
682
|
+
describe("with JobPosting MDX present", () => {
|
|
683
|
+
const stubGetMdxSource = jest
|
|
684
|
+
.fn<ReturnType<GetMdxSource>, Parameters<GetMdxSource>>()
|
|
685
|
+
.mockResolvedValue({
|
|
686
|
+
frontmatter: {
|
|
687
|
+
type: "JobPosting",
|
|
688
|
+
slug: "senior-fullstack-engineer",
|
|
689
|
+
title: "Senior Full-Stack Engineer",
|
|
690
|
+
description: "Build the AILK platform.",
|
|
691
|
+
},
|
|
692
|
+
body: "# Senior Full-Stack Engineer\n\nBody.",
|
|
693
|
+
});
|
|
694
|
+
|
|
695
|
+
beforeEach(() => stubGetMdxSource.mockClear());
|
|
696
|
+
|
|
697
|
+
it("renders the h1 from frontmatter", async () => {
|
|
698
|
+
await renderAsync(
|
|
699
|
+
CareersSlugPage({
|
|
700
|
+
params: Promise.resolve({
|
|
701
|
+
locale: "en",
|
|
702
|
+
slug: "senior-fullstack-engineer",
|
|
703
|
+
}),
|
|
704
|
+
getMdxSource: stubGetMdxSource,
|
|
705
|
+
}),
|
|
706
|
+
);
|
|
707
|
+
expect(screen.getByRole("heading", { level: 1 })).toHaveTextContent(
|
|
708
|
+
"Senior Full-Stack Engineer",
|
|
709
|
+
);
|
|
710
|
+
});
|
|
711
|
+
|
|
712
|
+
it("emits a JSON-LD script tag with @type WebPage and mainEntity JobPosting", async () => {
|
|
713
|
+
await renderAsync(
|
|
714
|
+
CareersSlugPage({
|
|
715
|
+
params: Promise.resolve({
|
|
716
|
+
locale: "en",
|
|
717
|
+
slug: "senior-fullstack-engineer",
|
|
718
|
+
}),
|
|
719
|
+
getMdxSource: stubGetMdxSource,
|
|
720
|
+
}),
|
|
721
|
+
);
|
|
722
|
+
const script = screen.getByTestId("json-ld");
|
|
723
|
+
const outer = JSON.parse(script.innerHTML) as { "@type": string; "@graph": Array<{ "@type": string; mainEntity: { "@type": string } }> };
|
|
724
|
+
expect(outer["@type"]).toBeUndefined();
|
|
725
|
+
const primary = outer["@graph"][0]!;
|
|
726
|
+
expect(primary["@type"]).toBe("WebPage");
|
|
727
|
+
expect(primary.mainEntity["@type"]).toBe("JobPosting");
|
|
728
|
+
});
|
|
729
|
+
|
|
730
|
+
it("renders the MDX body", async () => {
|
|
731
|
+
await renderAsync(
|
|
732
|
+
CareersSlugPage({
|
|
733
|
+
params: Promise.resolve({
|
|
734
|
+
locale: "en",
|
|
735
|
+
slug: "senior-fullstack-engineer",
|
|
736
|
+
}),
|
|
737
|
+
getMdxSource: stubGetMdxSource,
|
|
738
|
+
}),
|
|
739
|
+
);
|
|
740
|
+
expect(screen.getByTestId("mdx-body")).toBeInTheDocument();
|
|
741
|
+
});
|
|
742
|
+
});
|
|
743
|
+
|
|
744
|
+
describe("with no JobPosting MDX (unknown slug)", () => {
|
|
745
|
+
const stubGetMdxSource = jest
|
|
746
|
+
.fn<ReturnType<GetMdxSource>, Parameters<GetMdxSource>>()
|
|
747
|
+
.mockResolvedValue(null);
|
|
748
|
+
|
|
749
|
+
it("calls notFound() for an unknown slug", async () => {
|
|
750
|
+
await expect(
|
|
751
|
+
CareersSlugPage({
|
|
752
|
+
params: Promise.resolve({ locale: "en", slug: "unknown" }),
|
|
753
|
+
getMdxSource: stubGetMdxSource,
|
|
754
|
+
}),
|
|
755
|
+
).rejects.toThrow("NEXT_NOT_FOUND");
|
|
756
|
+
expect(mockNotFound).toHaveBeenCalled();
|
|
757
|
+
});
|
|
758
|
+
});
|
|
759
|
+
});
|
|
760
|
+
|
|
761
|
+
// ── generateStaticParams ──────────────────────────────────────────────────
|
|
762
|
+
|
|
763
|
+
describe("generateStaticParams", () => {
|
|
764
|
+
describe("howToStaticParams", () => {
|
|
765
|
+
it("returns a slug for each seeded HowTo", async () => {
|
|
766
|
+
mockPageRendererGetMdxSlugs.mockResolvedValue([
|
|
767
|
+
"set-up-json-ld",
|
|
768
|
+
"add-mdx-content",
|
|
769
|
+
]);
|
|
770
|
+
const params = await howToStaticParams({ params: { locale: "en" } });
|
|
771
|
+
expect(params).toEqual([
|
|
772
|
+
{ slug: "set-up-json-ld" },
|
|
773
|
+
{ slug: "add-mdx-content" },
|
|
774
|
+
]);
|
|
775
|
+
expect(mockPageRendererGetMdxSlugs).toHaveBeenCalledWith("HowTo", "en");
|
|
776
|
+
});
|
|
777
|
+
|
|
778
|
+
it("returns an empty array when no HowTo content is seeded", async () => {
|
|
779
|
+
mockPageRendererGetMdxSlugs.mockResolvedValue([]);
|
|
780
|
+
const params = await howToStaticParams({ params: { locale: "en" } });
|
|
781
|
+
expect(params).toEqual([]);
|
|
782
|
+
});
|
|
783
|
+
});
|
|
784
|
+
|
|
785
|
+
describe("techArticleStaticParams", () => {
|
|
786
|
+
it("returns a slug for each seeded TechArticle", async () => {
|
|
787
|
+
mockPageRendererGetMdxSlugs.mockResolvedValue(["json-ld-architecture"]);
|
|
788
|
+
const params = await techArticleStaticParams({
|
|
789
|
+
params: { locale: "en" },
|
|
790
|
+
});
|
|
791
|
+
expect(params).toEqual([{ slug: "json-ld-architecture" }]);
|
|
792
|
+
expect(mockPageRendererGetMdxSlugs).toHaveBeenCalledWith("TechArticle", "en");
|
|
793
|
+
});
|
|
794
|
+
});
|
|
795
|
+
|
|
796
|
+
describe("whitepaperStaticParams", () => {
|
|
797
|
+
it("returns a slug for each seeded Whitepaper", async () => {
|
|
798
|
+
mockPageRendererGetMdxSlugs.mockResolvedValue(["ax-first-product-development"]);
|
|
799
|
+
const params = await whitepaperStaticParams({
|
|
800
|
+
params: { locale: "en" },
|
|
801
|
+
});
|
|
802
|
+
expect(params).toEqual([{ slug: "ax-first-product-development" }]);
|
|
803
|
+
expect(mockPageRendererGetMdxSlugs).toHaveBeenCalledWith("Whitepaper", "en");
|
|
804
|
+
});
|
|
805
|
+
});
|
|
806
|
+
|
|
807
|
+
describe("softwareStaticParams", () => {
|
|
808
|
+
it("returns a slug for each seeded SoftwareProduct", async () => {
|
|
809
|
+
mockPageRendererGetMdxSlugs.mockResolvedValue(["ailk-schema", "ailk-aeo"]);
|
|
810
|
+
const params = await softwareStaticParams({ params: { locale: "en" } });
|
|
811
|
+
expect(params).toEqual([{ slug: "ailk-schema" }, { slug: "ailk-aeo" }]);
|
|
812
|
+
expect(mockPageRendererGetMdxSlugs).toHaveBeenCalledWith("SoftwareProduct", "en");
|
|
813
|
+
});
|
|
814
|
+
});
|
|
815
|
+
|
|
816
|
+
describe("careersSlugStaticParams (JobPosting)", () => {
|
|
817
|
+
it("returns a slug for each seeded JobPosting", async () => {
|
|
818
|
+
mockPageRendererGetMdxSlugs.mockResolvedValue([
|
|
819
|
+
"senior-fullstack-engineer",
|
|
820
|
+
"content-strategist",
|
|
821
|
+
]);
|
|
822
|
+
const params = await careersSlugStaticParams({
|
|
823
|
+
params: { locale: "en" },
|
|
824
|
+
});
|
|
825
|
+
expect(params).toEqual([
|
|
826
|
+
{ slug: "senior-fullstack-engineer" },
|
|
827
|
+
{ slug: "content-strategist" },
|
|
828
|
+
]);
|
|
829
|
+
expect(mockPageRendererGetMdxSlugs).toHaveBeenCalledWith(
|
|
830
|
+
"JobPosting",
|
|
831
|
+
"en",
|
|
832
|
+
);
|
|
833
|
+
});
|
|
834
|
+
|
|
835
|
+
it("returns an empty array when no JobPosting content is seeded", async () => {
|
|
836
|
+
mockPageRendererGetMdxSlugs.mockResolvedValue([]);
|
|
837
|
+
const params = await careersSlugStaticParams({
|
|
838
|
+
params: { locale: "en" },
|
|
839
|
+
});
|
|
840
|
+
expect(params).toEqual([]);
|
|
841
|
+
});
|
|
842
|
+
});
|
|
843
|
+
});
|
|
844
|
+
});
|