Files
lunch/tests/messages.test.ts
kai d1bf5196dd
release / which version (push) Successful in 1s
release / olares chart · sanity (push) Successful in 3s
release / app (push) Successful in 1m7s
release / tag and release (push) Successful in 2s
Own sign-in with passkeys, public entrance, market (26.11.2) (#3)
2026-11-06 19:32:34 +00:00

26 lines
889 B
TypeScript

import { readFileSync } from "node:fs";
import { describe, expect, it } from "vitest";
import { LOCALES } from "@/lib/locale";
// Neue Schlüssel in allen vier Sprachen (CLAUDE.md, Regel 1).
function keys(value: unknown, prefix = ""): string[] {
if (value && typeof value === "object") {
return Object.entries(value).flatMap(([k, v]) => keys(v, prefix ? `${prefix}.${k}` : k));
}
return [prefix];
}
const load = (l: string) => JSON.parse(readFileSync(`messages/${l}.json`, "utf8"));
describe("messages", () => {
const reference = keys(load("de")).sort();
for (const locale of LOCALES) {
it(`${locale} has the same keys as de`, () => {
expect(keys(load(locale)).sort()).toEqual(reference);
});
}
it("no emoji in UI texts", () => {
for (const locale of LOCALES) expect(JSON.stringify(load(locale))).not.toMatch(/\p{Extended_Pictographic}/u);
});
});