Skip to content

Commit

Permalink
more formatNumber tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mbostock committed Jun 10, 2024
1 parent 27ec3b8 commit 17ed038
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions test/marks/format-test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
import * as Plot from "@observablehq/plot";
import assert from "assert";

it("formatNumber(locale) does the right thing", () => {
assert.strictEqual(Plot.formatNumber()(Math.PI), "3.142");
assert.strictEqual(Plot.formatNumber()(12345), "12,345");
assert.strictEqual(Plot.formatNumber("en")(Math.PI), "3.142");
assert.strictEqual(Plot.formatNumber("en")(12345), "12,345");
assert.strictEqual(Plot.formatNumber("fr")(Math.PI), "3,142");
assert.strictEqual(Plot.formatNumber("fr")(12345), "12\u202f345");
});

it("formatMonth(locale, format) does the right thing", () => {
assert.strictEqual(Plot.formatMonth("en", "long")(0), "January");
assert.strictEqual(Plot.formatMonth("en", "short")(0), "Jan");
Expand Down

0 comments on commit 17ed038

Please sign in to comment.