From 604bdaee3ea2a33f241d32ef2deb04293451813d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ladislav=20Slez=C3=A1k?= Date: Thu, 10 Aug 2023 13:45:48 +0200 Subject: [PATCH] Test object identity --- web/src/i18n.test.js | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/web/src/i18n.test.js b/web/src/i18n.test.js index be53ddf8f9..6cf3513155 100644 --- a/web/src/i18n.test.js +++ b/web/src/i18n.test.js @@ -55,9 +55,8 @@ describe("i18n", () => { it("returns the original text and does not translate it", () => { const val = N_(text); - expect(val).toEqual(text); - expect(gettextFn).not.toHaveBeenCalled(); - expect(ngettextFn).not.toHaveBeenCalled(); + // test the object identity + expect(Object.is(val, text)).toBe(true); }); }); @@ -65,17 +64,15 @@ describe("i18n", () => { it("returns the singular form for value 1 and does not translate it", () => { const val = Nn_(singularText, pluralText, 1); - expect(val).toEqual(singularText); - expect(gettextFn).not.toHaveBeenCalled(); - expect(ngettextFn).not.toHaveBeenCalled(); + // test the object identity + expect(Object.is(val, singularText)).toBe(true); }); it("returns the plural form for value 42 and does not translate it", () => { const val = Nn_(singularText, pluralText, 42); - expect(val).toEqual(pluralText); - expect(gettextFn).not.toHaveBeenCalled(); - expect(ngettextFn).not.toHaveBeenCalled(); + // test the object identity + expect(Object.is(val, pluralText)).toBe(true); }); }); });