Files
descrybe/apps/web/src/lib/i18n/sync-a1-keys.test.ts
T

55 lines
1.6 KiB
TypeScript
Raw Normal View History

2026-08-17 00:39:25 +02:00
/**
2026-08-16 18:36:56 +02:00
* Focused check: admin Sync A1 i18n keys exist in every UI_LOCALES pack.
2026-08-16 16:57:36 +02:00
*/
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";
2026-08-16 18:36:56 +02:00
const SYNC_A1_KEYS = [
"admin.users.syncA1",
"admin.users.syncA1Aria",
"admin.users.syncA1Title",
"admin.users.syncA1Desc",
"admin.users.syncA1Company",
"admin.users.syncA1Warning",
2026-08-17 00:39:25 +02:00
"admin.users.syncA1WpUpload",
"admin.users.syncA1WpUploadHint",
"admin.users.syncA1WpUploadClear",
2026-08-16 18:36:56 +02:00
"admin.users.syncA1Cancel",
"admin.users.syncA1Confirm",
"flash.admin.syncA1Success",
"flash.admin.syncA1Error"
2026-08-16 16:57:36 +02:00
] as const;
2026-08-16 18:36:56 +02:00
describe("admin Sync A1 i18n keys", () => {
it("English defines every Sync A1 key", () => {
for (const key of SYNC_A1_KEYS) {
2026-08-16 16:57:36 +02:00
assert.equal(typeof en[key], "string", key);
assert.ok(en[key].trim().length > 0, key);
}
});
2026-08-16 18:36:56 +02:00
it("every registered UI locale has Sync A1 keys", async () => {
2026-08-16 16:57:36 +02:00
await loadAllMessages();
for (const { code } of UI_LOCALES) {
const pack = code === "en" ? en : messagesFor(code);
2026-08-16 18:36:56 +02:00
for (const key of SYNC_A1_KEYS) {
2026-08-16 16:57:36 +02:00
const value = pack[key];
assert.equal(typeof value, "string", `${code}:${key}`);
assert.ok(String(value).trim().length > 0, `${code}:${key}`);
}
}
});
2026-08-16 18:36:56 +02:00
it("Slovenian ready pack has Sync A1 keys (outside UI_LOCALES)", () => {
for (const key of SYNC_A1_KEYS) {
2026-08-16 16:57:36 +02:00
assert.equal(typeof sl[key], "string", key);
assert.ok(sl[key].trim().length > 0, key);
}
});
});