test: include zh-only articles in static routes

This commit is contained in:
WangCham
2026-10-09 15:14:02 +08:00
parent 154aa71fda
commit 1db1f06610
2 changed files with 3 additions and 1 deletions
+2 -1
View File
@@ -4,6 +4,7 @@ import path from "node:path";
import test from "node:test";
import { unified } from "unified";
import remarkParse from "remark-parse";
import { zhOnlyArticleRoutes } from "./article-routes.mjs";
const root = path.resolve(import.meta.dirname, "..");
const output = process.env.AGENT_TEST_OUTPUT ?? path.join(root, "dist/public");
@@ -22,7 +23,7 @@ function links(node, result = []) {
}
test("every sitemap page has meaningful canonical Markdown and HTML discovery", async () => {
assert.equal(urls.length, 482);
assert.equal(urls.length, 482 + zhOnlyArticleRoutes.length);
for (const url of urls) {
const route = relative(url);
const text = await read(`${route}.md`);
+1
View File
@@ -204,6 +204,7 @@ test("canonical sitemap routes match the legacy Mintlify directory structure", a
for (const locale of ["en", "zh", "ja"]) {
legacy.add(`/${locale}/usage/platforms/mattermost`);
}
for (const route of zhOnlyArticleRoutes) legacy.add(`/zh/${route}`);
const sitemap = await readFile(path.join(publicRoot, "sitemap.xml"), "utf8");
const actual = new Set([...sitemap.matchAll(/<loc>https:\/\/langbot\.app\/docs(\/[^<]+)<\/loc>/g)]
.map((match) => decodeURIComponent(match[1]).replace(/\/$/, "")));