Files
HiveGrid-Wireframes/03 Quellen und Referenzen/hivegrid-cloud/apps/web/app/components/screens/chat/chat-message-discovery-i18n.test.ts
T

43 lines
1.8 KiB
TypeScript

import { describe, expect, it } from "vitest";
import { readMergedLocaleNamespace } from "~/utils/testing/repoPaths";
type MessageDiscoveryTranslations = {
chat: {
messageDiscovery: {
search: Record<string, string>;
mentions: Record<string, string>;
actions: Record<string, string>;
result: Record<string, string>;
};
};
};
function readTranslations(locale: "de" | "de-formal" | "en"): MessageDiscoveryTranslations {
return readMergedLocaleNamespace<MessageDiscoveryTranslations>(locale, "translations");
}
describe("AK-P15b message discovery translations", () => {
it("ships the same complete search and mentions contract in every locale", () => {
const reference = readTranslations("en").chat.messageDiscovery;
for (const locale of ["de", "de-formal", "en"] as const) {
const translations = readTranslations(locale).chat.messageDiscovery;
expect(Object.keys(translations.search)).toEqual(Object.keys(reference.search));
expect(Object.keys(translations.mentions)).toEqual(Object.keys(reference.mentions));
expect(Object.keys(translations.actions)).toEqual(Object.keys(reference.actions));
expect(Object.keys(translations.result)).toEqual(Object.keys(reference.result));
for (const group of Object.values(translations)) {
for (const value of Object.values(group)) expect(value.trim()).not.toBe("");
}
expect(translations.result.openAria).toContain("{{author}}");
expect(translations.result.openAria).toContain("{{channel}}");
}
});
it("uses formal address in the German formal search copy", () => {
const formal = readTranslations("de-formal").chat.messageDiscovery;
expect(formal.search.subtitle).toContain("Sie");
expect(formal.search.emptyBody).toContain("Geben Sie");
});
});