Files
descrybe/apps/web/src/lib/i18n/sync-a1-keys.test.ts
T
2026-08-16 18:36:56 +02:00

52 lines
1.5 KiB
TypeScript

/**
* Focused check: admin Sync A1 i18n keys exist in every UI_LOCALES pack.
*/
import assert from "node:assert/strict";
import { describe, it } from "node:test";
import { UI_LOCALES } from "./locales.ts";
import { en } from "./messages/en.ts";
import { loadAllMessages, messagesFor } from "./messages/catalog.ts";
import { sl } from "./messages/sl.ts";
const SYNC_A1_KEYS = [
"admin.users.syncA1",
"admin.users.syncA1Aria",
"admin.users.syncA1Title",
"admin.users.syncA1Desc",
"admin.users.syncA1Company",
"admin.users.syncA1Warning",
"admin.users.syncA1Cancel",
"admin.users.syncA1Confirm",
"flash.admin.syncA1Success",
"flash.admin.syncA1Error"
] as const;
describe("admin Sync A1 i18n keys", () => {
it("English defines every Sync A1 key", () => {
for (const key of SYNC_A1_KEYS) {
assert.equal(typeof en[key], "string", key);
assert.ok(en[key].trim().length > 0, key);
}
});
it("every registered UI locale has Sync A1 keys", async () => {
await loadAllMessages();
for (const { code } of UI_LOCALES) {
const pack = code === "en" ? en : messagesFor(code);
for (const key of SYNC_A1_KEYS) {
const value = pack[key];
assert.equal(typeof value, "string", `${code}:${key}`);
assert.ok(String(value).trim().length > 0, `${code}:${key}`);
}
}
});
it("Slovenian ready pack has Sync A1 keys (outside UI_LOCALES)", () => {
for (const key of SYNC_A1_KEYS) {
assert.equal(typeof sl[key], "string", key);
assert.ok(sl[key].trim().length > 0, key);
}
});
});