Skip to content

Commit

Permalink
Test object identity
Browse files Browse the repository at this point in the history
  • Loading branch information
lslezak committed Aug 10, 2023
1 parent 455af92 commit 604bdae
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions web/src/i18n.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,27 +55,24 @@ 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);
});
});

describe("Nn_", () => {
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);
});
});
});

0 comments on commit 604bdae

Please sign in to comment.