mirror of
https://github.com/snapotter-hq/SnapOtter.git
synced 2026-08-03 07:46:42 +02:00
Shared Claude Code translation pipeline (scripts/i18n, no API key) plus Astro/VitePress/Scalar i18n wiring. Landing and API reference translated into all 20 languages; docs i18n wiring + English source anchors. The translated docs markdown (apps/docs/<locale>/**, 3,620 files) follows in a companion PR because it exceeds GitHub's per-PR CI file limit.
30 lines
1.1 KiB
TypeScript
30 lines
1.1 KiB
TypeScript
// tests/unit/scripts/i18n/validate.test.ts
|
|
import { describe, expect, it } from "vitest";
|
|
import { validate } from "../../../../scripts/i18n/lib/validate.mjs";
|
|
|
|
const SRC = "```\ncode\n```\nUse `x` and [t](/u) with {name}.";
|
|
|
|
describe("validate", () => {
|
|
it("passes when structure is preserved", () => {
|
|
const translated = "```\ncode\n```\nBenutze `x` und [Text](/u) mit {name}.";
|
|
expect(validate(SRC, translated)).toEqual({ ok: true, errors: [] });
|
|
});
|
|
|
|
it("fails when a code fence is dropped", () => {
|
|
const translated = "Benutze `x` und [Text](/u) mit {name}.";
|
|
const result = validate(SRC, translated);
|
|
expect(result.ok).toBe(false);
|
|
expect(result.errors.join(" ")).toMatch(/fences/);
|
|
});
|
|
|
|
it("fails when a placeholder count changes", () => {
|
|
const translated = "```\ncode\n```\nBenutze `x` und [Text](/u) mit {name} {name}.";
|
|
expect(validate(SRC, translated).ok).toBe(false);
|
|
});
|
|
|
|
it("fails when a mask token leaked into the output", () => {
|
|
const translated = `${SRC}⸤I18N0⸥`;
|
|
expect(validate(SRC, translated).ok).toBe(false);
|
|
});
|
|
});
|