election-game/web/test/game.test.ts

10 lines
253 B
TypeScript

import { describe, expect, it } from "vitest";
import { pct } from "../src/game/format.ts";
describe("顯示用的小工具", () => {
it("百分比", () => {
expect(pct(0.4567)).toBe("45.7%");
expect(pct(0.4567, 2)).toBe("45.67%");
});
});