remove more duplicate classes; add additional values functions; clean up tests

This commit is contained in:
Tom Hunkapiller
2021-05-24 11:28:10 +03:00
parent a56119e7cd
commit ce2a0fb864
38 changed files with 311 additions and 362 deletions

View File

@ -4,6 +4,7 @@ import {
hpsMeasureValue,
positiveUniversalMeasureValue,
signedTwipsMeasureValue,
twipsMeasureValue,
universalMeasureValue,
unsignedDecimalNumber,
} from "./values";
@ -89,6 +90,20 @@ describe("values", () => {
});
});
describe("twipsMeasureValue", () => {
it("should allow valid values", () => {
expect(twipsMeasureValue(1243)).to.eq(1243);
expect(twipsMeasureValue("5mm")).to.eq("5mm");
expect(twipsMeasureValue("10.in")).to.eq("10in");
});
it("should throw on invalid values", () => {
expect(() => twipsMeasureValue(-12)).to.throw();
expect(() => twipsMeasureValue(NaN)).to.throw();
expect(() => twipsMeasureValue("foo")).to.throw();
expect(() => twipsMeasureValue("-5mm")).to.throw();
});
});
describe("hpsMeasureValue", () => {
it("should allow valid values", () => {
expect(hpsMeasureValue(1243)).to.eq(1243);