import { describe, expect, it } from "vitest"; import { formatAmount } from "./format"; describe("formatAmount", () => { it("groups thousands in the app's language", () => { expect(formatAmount(12345, "credits", "en")).toBe("12,345"); expect(formatAmount(12345, "requests", "en")).toBe("12,345"); expect(formatAmount(12345, "credits", "fr").replace(/\s/g, " ")).toBe("12 345"); }); it("formats dollars as the language writes currency", () => { expect(formatAmount(1234.5, "usd", "en")).toBe("$1,234.50"); expect(formatAmount(1234.5, "usd", "fr").replace(/\s/g, " ")).toBe("1 234,50 $US"); }); });