2020-12-24 03:37:43 +00:00
|
|
|
import { expect } from "chai";
|
2021-03-12 03:58:05 +00:00
|
|
|
|
|
|
|
import { convertInchesToTwip, convertMillimetersToTwip, uniqueId, uniqueNumericId } from "./convenience-functions";
|
2020-12-24 03:37:43 +00:00
|
|
|
|
|
|
|
describe("Utility", () => {
|
|
|
|
describe("#convertMillimetersToTwip", () => {
|
2022-07-12 17:10:37 +01:00
|
|
|
it("should convert millimeters to TWIP", () => {
|
2020-12-24 03:37:43 +00:00
|
|
|
expect(convertMillimetersToTwip(1000)).to.equal(56692);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
describe("#convertInchesToTwip", () => {
|
2022-07-12 17:10:37 +01:00
|
|
|
it("should convert inches to TWIP", () => {
|
2020-12-24 03:37:43 +00:00
|
|
|
expect(convertInchesToTwip(1)).to.equal(1440);
|
|
|
|
expect(convertInchesToTwip(0.5)).to.equal(720);
|
|
|
|
expect(convertInchesToTwip(0.25)).to.equal(360);
|
|
|
|
});
|
|
|
|
});
|
2021-03-12 03:58:05 +00:00
|
|
|
|
|
|
|
describe("#uniqueNumericId", () => {
|
2021-05-22 03:32:37 +03:00
|
|
|
it("should generate a unique incrementing ID", () => {
|
2021-03-24 03:09:01 +00:00
|
|
|
expect(uniqueNumericId()).to.not.be.undefined;
|
2021-03-12 03:58:05 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
describe("#uniqueId", () => {
|
2021-05-22 03:32:37 +03:00
|
|
|
it("should generate a unique pseudorandom ID", () => {
|
2021-03-12 03:58:05 +00:00
|
|
|
expect(uniqueId()).to.not.be.empty;
|
|
|
|
});
|
|
|
|
});
|
2020-12-24 03:37:43 +00:00
|
|
|
});
|