ktx/docs-site/tests/docs-index-route.test.mjs
Luca Martial b4a302edfa fix(docs-site): add docs index redirect, test, and trim Accept media type
Redirect bare /docs to the introduction page with proper metadata
resolution. Add a test for the redirect. Trim the media type in the
Accept header parser so whitespace around semicolons does not break
markdown content negotiation. Add a test script to package.json.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-05-11 20:37:28 -07:00

14 lines
433 B
JavaScript

import assert from "node:assert/strict";
import test from "node:test";
const docsSiteUrl = process.env.DOCS_SITE_URL ?? "http://localhost:3000";
test("/docs redirects to the docs introduction", async () => {
const response = await fetch(`${docsSiteUrl}/docs`, { redirect: "manual" });
assert.equal(response.status, 307);
assert.equal(
response.headers.get("location"),
"/docs/getting-started/introduction",
);
});