formats.exposed/test/common/pluralize.test.ts

13 lines
419 B
TypeScript
Raw Normal View History

import { assertEquals } from "assert";
import pluralize from "../../public/common/pluralize.js";
Deno.test("doesn't pluralize when count is 1", () => {
assertEquals(pluralize(1, "apple"), "1 apple");
});
Deno.test("pluralizes when count is not 1", () => {
assertEquals(pluralize(-1, "apple"), "-1 apples");
assertEquals(pluralize(0, "apple"), "0 apples");
assertEquals(pluralize(2, "apple"), "2 apples");
});