From 12d7a0ab97246646ae314f9cc3d663b8b8a590cd Mon Sep 17 00:00:00 2001 From: David Baker Date: Thu, 27 Nov 2025 18:38:25 +0000 Subject: [PATCH] Simple test for i18napi --- .../src/utils/I18nApi.test.ts | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 packages/shared-components/src/utils/I18nApi.test.ts diff --git a/packages/shared-components/src/utils/I18nApi.test.ts b/packages/shared-components/src/utils/I18nApi.test.ts new file mode 100644 index 0000000000..e8f7dd36bc --- /dev/null +++ b/packages/shared-components/src/utils/I18nApi.test.ts @@ -0,0 +1,22 @@ +/* + * Copyright 2025 Element Creations Ltd. + * + * SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only OR LicenseRef-Element-Commercial + * Please see LICENSE files in the repository root for full details. + */ + +import { TranslationKey } from "../i18nKeys"; +import { I18nApi } from "./I18nApi"; + +describe("I18nApi", () => { + it("can register a translation and use it", () => { + const i18n = new I18nApi(); + i18n.register({ + "hello.world": { + en: "Hello, World!", + }, + }); + + expect(i18n.translate("hello.world" as TranslationKey)).toBe("Hello, World!"); + }); +});