import { test } from "node:test"; import assert from "node:assert/strict"; import { readFileSync } from "node:fs"; import { fileURLToPath } from "node:url"; import { dirname, resolve } from "node:path"; // #5695 — the dashboard Quick Start step 1 told users to "Go to Endpoint -> // Registered Keys", linking to /dashboard/endpoint. But API keys are created on // the API Manager page (/dashboard/api-manager, sidebar label "API Keys"); the // Endpoint page has no "Registered Keys" section. Users followed the link and // could not find where to create a key. Step 1 must point at API Keys. const here = dirname(fileURLToPath(import.meta.url)); const source = readFileSync( resolve(here, "../../../src/app/(dashboard)/dashboard/HomePageClient.tsx"), "utf8" ); const messages = JSON.parse( readFileSync(resolve(here, "../../../src/i18n/messages/en.json"), "utf8") ) as { home: { step1Desc: string } }; test("#5695 Quick Start step 1 links to the API Manager (API Keys), not Endpoint", () => { // The endpoint render-prop Link inside the step1Desc rich block. // NB: tolerate Prettier splitting `` across lines (\s+ between // the tag and the attr) — otherwise the regex skips the multi-line step1 Link // and wrongly matches the single-line step2 `/dashboard/providers` Link. const hrefMatch = source.match(/t\.rich\("step1Desc"[\s\S]*? { const desc = messages.home.step1Desc; assert.ok(desc.includes("API Keys"), `step1Desc should mention "API Keys"; got: "${desc}"`); assert.ok( !desc.includes("Registered Keys"), `step1Desc must not send users to "Registered Keys" under Endpoint; got: "${desc}"` ); });