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

45 lines
1.8 KiB
TypeScript

import { describe, expect, it } from "vitest";
import { readMergedLocaleNamespace } from "~/utils/testing/repoPaths";
type ChatCreateTranslations = {
chat: {
channelList: { actions: { newDm: string; newGroup: string } };
channelCreate: {
title: string;
subtitle: string;
fields: { membersHelp: string; peerHelp: string };
users: { loading: string; empty: string };
permissions: { none: string; noneBody: string };
validation: Record<string, string>;
};
};
};
function readTranslations(locale: "de" | "de-formal" | "en"): ChatCreateTranslations {
return readMergedLocaleNamespace<ChatCreateTranslations>(locale, "translations");
}
describe("AK-P15b chat create translations", () => {
it("ships complete German and English base copy for the create surface", () => {
const de = readTranslations("de");
const en = readTranslations("en");
expect(de.chat.channelList.actions).toMatchObject({ newDm: "Neue Direktnachricht", newGroup: "Neuer Channel" });
expect(en.chat.channelList.actions).toMatchObject({ newDm: "New direct message", newGroup: "New channel" });
expect(de.chat.channelCreate.users.loading).toMatch(/geladen/);
expect(en.chat.channelCreate.users.loading).toMatch(/Loading/);
expect(Object.keys(de.chat.channelCreate.validation)).toEqual(Object.keys(en.chat.channelCreate.validation));
});
it("uses formal address in the German formal overlay", () => {
const formal = readTranslations("de-formal");
expect(formal.chat.channelCreate.subtitle).toContain("Sie");
expect(formal.chat.channelCreate.fields.membersHelp).toContain("Sie");
expect(formal.chat.channelCreate.fields.peerHelp).toContain("Wählen Sie");
expect(formal.chat.channelCreate.permissions.none).toContain("Sie");
expect(formal.chat.channelCreate.permissions.noneBody).toContain("Ihnen");
});
});