diff --git a/package.json b/package.json index c93bb6b..fa8cf0d 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,8 @@ "start": "next start -p 3020", "lint": "eslint", "typecheck": "tsc --noEmit --pretty false", - "check": "pnpm lint && pnpm typecheck && pnpm build" + "test:home-navigation": "node scripts/test-home-navigation.mjs", + "check": "pnpm lint && pnpm typecheck && pnpm test:home-navigation && pnpm build" }, "dependencies": { "@base-ui/react": "^1.5.0", diff --git a/scripts/test-home-navigation.mjs b/scripts/test-home-navigation.mjs new file mode 100644 index 0000000..06fb5be --- /dev/null +++ b/scripts/test-home-navigation.mjs @@ -0,0 +1,24 @@ +import assert from "node:assert/strict"; +import { readFile, access } from "node:fs/promises"; +import path from "node:path"; +import { fileURLToPath } from "node:url"; + +const scriptDir = path.dirname(fileURLToPath(import.meta.url)); +const repoRoot = path.resolve(scriptDir, ".."); +const homeSourcePath = path.join(repoRoot, "src/components/product-home.tsx"); +const validatePagePath = path.join(repoRoot, "src/app/validate/page.tsx"); + +const homeSource = await readFile(homeSourcePath, "utf8"); + +const validateHrefPattern = + /]*\bhref=\{?\s*["']\/validate["']\s*\}?[^>]*>/; + +assert.match( + homeSource, + validateHrefPattern, + "Expected homepage to contain a static /validate Link href.", +); + +await access(validatePagePath); + +console.log("Home navigation contract OK: homepage links to /validate and page exists."); diff --git a/src/components/product-home.tsx b/src/components/product-home.tsx index d576cb1..67afd70 100644 --- a/src/components/product-home.tsx +++ b/src/components/product-home.tsx @@ -153,6 +153,15 @@ export function ProductHome() { Watch guided replay + + + Validate an event payload + + + Trusted by leading AI teams
Trusted by leading AI teams