import { readFileSync } from "node:fs"; import { resolve } from "node:path"; import { describe, expect, it } from "vitest"; function readMessages(locale: "ru" | "en") { const filepath = resolve(process.cwd(), "messages", `${locale}.json`); return JSON.parse(readFileSync(filepath, "utf-8")) as Record; } describe("message catalogs", () => { it("have the same keyset for ru and en", () => { const ru = readMessages("ru"); const en = readMessages("en"); const ruKeys = Object.keys(ru).sort(); const enKeys = Object.keys(en).sort(); expect(ruKeys).toEqual(enKeys); }); it("have non-empty translations", () => { const catalogs = [readMessages("ru"), readMessages("en")]; for (const catalog of catalogs) { for (const [key, value] of Object.entries(catalog)) { expect( value.trim().length, `Empty translation for key: ${key}`, ).toBeGreaterThan(0); } } }); });