52 lines
1.5 KiB
TypeScript
52 lines
1.5 KiB
TypeScript
/**
|
|||
|
|
* Focused check: admin Fix 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 FIX_A1_KEYS = [
|
||
|
|
"admin.users.fixA1",
|
||
|
|
"admin.users.fixA1Aria",
|
||
|
|
"admin.users.fixA1Title",
|
||
|
|
"admin.users.fixA1Desc",
|
||
|
|
"admin.users.fixA1Company",
|
||
|
|
"admin.users.fixA1Warning",
|
||
|
|
"admin.users.fixA1Cancel",
|
||
|
|
"admin.users.fixA1Confirm",
|
||
|
|
"flash.admin.fixA1Success",
|
||
|
|
"flash.admin.fixA1Error"
|
||
|
|
] as const;
|
||
|
|
|
||
|
|
describe("admin Fix A1 i18n keys", () => {
|
||
|
|
it("English defines every Fix A1 key", () => {
|
||
|
|
for (const key of FIX_A1_KEYS) {
|
||
|
|
assert.equal(typeof en[key], "string", key);
|
||
|
|
assert.ok(en[key].trim().length > 0, key);
|
||
|
|
}
|
||
|
|
});
|
||
|
|
|
||
|
|
it("every registered UI locale has Fix A1 keys", async () => {
|
||
|
|
await loadAllMessages();
|
||
|
|
for (const { code } of UI_LOCALES) {
|
||
|
|
const pack = code === "en" ? en : messagesFor(code);
|
||
|
|
for (const key of FIX_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 Fix A1 keys (not in UI_LOCALES)", () => {
|
||
|
|
for (const key of FIX_A1_KEYS) {
|
||
|
|
assert.equal(typeof sl[key], "string", key);
|
||
|
|
assert.ok(sl[key].trim().length > 0, key);
|
||
|
|
}
|
||
|
|
});
|
||
|
|
});
|