mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-10-29 11:56:02 +08:00
test: include zh-only articles in static routes
This commit is contained in:
@@ -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`);
|
||||
|
||||
@@ -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(/\/$/, "")));
|
||||
|
||||
Reference in New Issue
Block a user