Files
HiveGrid-Wireframes/hivegrid-cloud/apps/web/app/utils/theme/defaultThemes.i18n.test.ts
T

27 lines
941 B
TypeScript

import fs from "node:fs";
import path from "node:path";
import { describe, expect, it } from "vitest";
import { defaultThemes } from "./defaultThemes";
const repoRoot = process.cwd();
function readSettings(locale: "de" | "en") {
return JSON.parse(fs.readFileSync(path.join(repoRoot, `apps/web/public/locales/${locale}/settings.json`), "utf8")) as Record<string, string>;
}
describe("default theme preset i18n", () => {
it("keeps every visible preset label backed by English and German settings keys", () => {
const en = readSettings("en");
const de = readSettings("de");
for (const theme of defaultThemes) {
expect(theme.labelKey).toBe(`settings:tenant.theme.presets.${theme.value}`);
const localeKey = theme.labelKey.replace("settings:", "");
expect(en[localeKey], `${theme.value} English label`).toBeTruthy();
expect(de[localeKey], `${theme.value} German label`).toBeTruthy();
}
});
});