import { describe, expect, it } from "vitest"; import type { TFunction } from "i18next"; import { PropertyAttributeName } from "~/application/enums/entities/PropertyAttributeName"; import PropertyAttributeHelper from "./PropertyAttributeHelper"; describe("PropertyAttributeHelper", () => { it("localizes visible property attribute option labels when a translator is provided", () => { const t = (key: string) => ({ "formats.boolean.yesNo": "Ja/Nein", "formats.boolean.trueFalse": "Wahr/Falsch", "formats.boolean.enabledDisabled": "Aktiviert/Deaktiviert", "formats.boolean.onOff": "An/Aus", "formats.boolean.activeInactive": "Aktiv/Inaktiv", })[key] ?? key; expect(PropertyAttributeHelper.getPropertyAttributeOptions(PropertyAttributeName.FormatBoolean, t as unknown as TFunction)).toEqual([ { name: "Ja/Nein", value: "yesNo", labelKey: "formats.boolean.yesNo" }, { name: "Wahr/Falsch", value: "trueFalse", labelKey: "formats.boolean.trueFalse" }, { name: "Aktiviert/Deaktiviert", value: "enabledDisabled", labelKey: "formats.boolean.enabledDisabled" }, { name: "An/Aus", value: "onOff", labelKey: "formats.boolean.onOff" }, { name: "Aktiv/Inaktiv", value: "activeInactive", labelKey: "formats.boolean.activeInactive" }, ]); }); });