Skip to content

Commit

Permalink
test: Add tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
vxern committed Sep 18, 2024
1 parent 9124c6c commit d6c4b43
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { describe, it } from "bun:test";
import pluralise from "logos:constants/transformers/pluralisers/common-slavic.ts";
import pluralise from "logos:constants/transformers/pluralisers/common-slavic";
import { expect } from "chai";

describe("pluralise()", () => {
Expand Down
30 changes: 28 additions & 2 deletions test/source/constants/transformers/pluralisers/invariant.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,31 @@
import { describe } from "bun:test";
import { describe, it } from "bun:test";
import { expect } from "chai";
import pluralise from "logos:constants/transformers/pluralisers/invariant";

describe("pluralise()", () => {
// TODO(vxern): Test.
const FORMS = { one: "ember" };

it("returns undefined if the passed object does not contain form `one`.", () => {
expect(pluralise("0", {})).to.be.undefined;
});

it("returns the singular form when the quantity is 1.", () => {
expect(pluralise("1", FORMS)).to.equal("ember");
});

it("returns the singular form when the quantity is 0.", () => {
expect(pluralise("0", FORMS)).to.equal("ember");
});

it("returns the singular form when the quantity is -1.", () => {
expect(pluralise("-1", FORMS)).to.equal("ember");
});

it("returns the singular form when the quantity is 2 or more.", () => {
expect(pluralise("2", FORMS)).to.equal("ember");
});

it("returns the singular form when the quantity is -2 or less.", () => {
expect(pluralise("-2", FORMS)).to.equal("ember");
});
});

0 comments on commit d6c4b43

Please sign in to comment.