Skip to content

Commit 17ed038

Browse files
committed
more formatNumber tests
1 parent 27ec3b8 commit 17ed038

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

test/marks/format-test.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11
import * as Plot from "@observablehq/plot";
22
import assert from "assert";
33

4+
it("formatNumber(locale) does the right thing", () => {
5+
assert.strictEqual(Plot.formatNumber()(Math.PI), "3.142");
6+
assert.strictEqual(Plot.formatNumber()(12345), "12,345");
7+
assert.strictEqual(Plot.formatNumber("en")(Math.PI), "3.142");
8+
assert.strictEqual(Plot.formatNumber("en")(12345), "12,345");
9+
assert.strictEqual(Plot.formatNumber("fr")(Math.PI), "3,142");
10+
assert.strictEqual(Plot.formatNumber("fr")(12345), "12\u202f345");
11+
});
12+
413
it("formatMonth(locale, format) does the right thing", () => {
514
assert.strictEqual(Plot.formatMonth("en", "long")(0), "January");
615
assert.strictEqual(Plot.formatMonth("en", "short")(0), "Jan");

0 commit comments

Comments
 (0)