opencode / packages /ui /src /context /i18n.test.ts
SaylorTwift's picture
SaylorTwift HF Staff
Add files using upload-large-folder tool
eb1202c verified
Raw History Blame Contribute Delete
629 Bytes
import { describe, expect, test } from "bun:test"
import { pluralCategory } from "./i18n"
describe("pluralCategory", () => {
test.each([
["en", 0, "other"],
["en", 1, "one"],
["fr", 0, "one"],
["fr", 1_000_000, "many"],
["ru", 1, "one"],
["ru", 2, "few"],
["ru", 5, "many"],
["ru", 21, "one"],
["ar", 0, "zero"],
["ar", 1, "one"],
["ar", 2, "two"],
["ar", 3, "few"],
["ar", 11, "many"],
["ar", 100, "other"],
["ja", 1, "other"],
] as const)("selects %s for %d as %s", (locale, count, expected) => {
expect(pluralCategory(locale, count)).toBe(expected)
})
})