Initial commit of Descrybe v2 without local scratch artifacts.

Drop one-shot tmp/axe scripts and agent i18n scratch so the Gitea tree is deployable.
This commit is contained in:
greeneclipse committed 2026-08-09 22:47:43 +02:00
commit 8580c996c3
1285 files changed
+325780

No files matched your search

@@ -0,0 +1,46 @@
/**
* Content-language allowlist sync (node:test).
* CONTENT_LANGUAGES codes must match apps/api/internal/company/language.go ContentLanguages.
*
* Run from apps/web:
* node --experimental-strip-types --test src/lib/content-languages.test.ts
*/
import assert from "node:assert/strict";
import { readFileSync } from "node:fs";
import { dirname, join } from "node:path";
import { describe, it } from "node:test";
import { fileURLToPath } from "node:url";
import { CONTENT_LANGUAGES } from "./content-languages.ts";
const here = dirname(fileURLToPath(import.meta.url));
const goLanguagePath = join(here, "../../../api/internal/company/language.go");
/** Extract quoted codes from `var ContentLanguages = []string{ ... }`. */
function parseGoContentLanguageCodes(src: string): string[] {
const marker = "var ContentLanguages = []string{";
const start = src.indexOf(marker);
assert.ok(start >= 0, "ContentLanguages slice not found in language.go");
const end = src.indexOf("}", start);
assert.ok(end > start, "ContentLanguages closing brace not found");
const block = src.slice(start, end);
const codes: string[] = [];
for (const match of block.matchAll(/"([a-z]{2})"/g)) {
codes.push(match[1]!);
}
assert.ok(codes.length > 0, "no language codes parsed from Go allowlist");
return codes;
}
describe("content-languages Web↔Go allowlist sync", () => {
it("CONTENT_LANGUAGES values match company.ContentLanguages / ParseLanguage allowlist", () => {
const goSrc = readFileSync(goLanguagePath, "utf8");
const goCodes = parseGoContentLanguageCodes(goSrc);
const webCodes = CONTENT_LANGUAGES.map((l) => l.value);
assert.deepEqual(
webCodes,
goCodes,
"Keep apps/web/src/lib/content-languages.ts in sync with apps/api/internal/company/language.go"
);
});
});