import assert from "node:assert"; import { describe, it } from "node:test"; import * as Either from "effect/Either"; import { failWith } from "./Function.js"; import { localeContentAttribute__number } from "./Number.js"; import { pipe } from "effect/Function"; describe("codecs", () => { describe("localeContentAttribute__number", () => { it("should not be valid with two decimal separators", () => { const content = "12.34."; assert.throws(() => { pipe( localeContentAttribute__number("en").decode(content), Either.getOrElse(failWith), ); }); }); it("should encode according to locale", () => { assert.equal( pipe( localeContentAttribute__number("de").encode(3.1415), Either.getOrElse(() => ""), ), "3,1415", ); }); }); });