diff --git a/apps/docs/scripts/auth-cli.ts b/apps/docs/scripts/auth-cli.ts index 55507d6..78f376c 100644 --- a/apps/docs/scripts/auth-cli.ts +++ b/apps/docs/scripts/auth-cli.ts @@ -200,11 +200,15 @@ async function main() { for (const doc of searchIndex as { slug: string; sourceSlug: string }[]) { assert.ok(!doc.slug.split("/").some((part) => /^\d+-/.test(part)), doc.slug); const legacy = await request(`/docs/${doc.sourceSlug}?from=legacy`, { headers }); - assert.equal(legacy.status, 308, doc.sourceSlug); - const destination = new URL(legacy.headers.get("location")!, base); - assert.equal(destination.pathname, `/docs/${doc.slug}`); - assert.equal(destination.searchParams.get("from"), "legacy"); assert.ok(legacy.headers.get("cache-control")?.includes("no-store")); + if (doc.sourceSlug === doc.slug) { + assert.equal(legacy.status, 200, doc.sourceSlug); + } else { + assert.equal(legacy.status, 308, doc.sourceSlug); + const destination = new URL(legacy.headers.get("location")!, base); + assert.equal(destination.pathname, `/docs/${doc.slug}`); + assert.equal(destination.searchParams.get("from"), "legacy"); + } } const routes = ["/", ...searchIndex.map((doc: { slug: string }) => `/docs/${doc.slug}`)]; const raw = await request("/api/documents/source?slug=endor/endor-purpose-draft", { headers });