@fractorysolutions/safe-units
Version:
Type-safe TypeScript units of measure
33 lines • 1.13 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
var Quantity = require("../quantities");
describe("Quantities", function () {
var QuantityNames = Object.keys(Quantity);
function forEachQuantity(fn) {
QuantityNames.forEach(function (name) {
fn(Quantity[name], name);
});
}
it("no two quantities should have the same dimensions", function () {
forEachQuantity(function (a, aName) {
forEachQuantity(function (b, bName) {
if (aName === bName) {
return;
}
try {
expect(a.unit).not.toEqual(b.unit);
}
catch (e) {
console.log("Quantities '".concat(aName, "' and '").concat(bName, "' are the same."));
throw e;
}
});
});
});
it("all quantities should be normalized", function () {
forEachQuantity(function (quantity) {
expect(quantity.value).toBe(1);
});
});
});
//# sourceMappingURL=quantityTests.js.map