@0xcert/utils
Version:
General utility module with common helper functions.
18 lines • 654 B
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
const spec_1 = require("@hayspec/spec");
const __1 = require("../..");
const spec = new spec_1.Spec();
spec.test('converts milliseconds to seconds', (ctx) => {
ctx.is(__1.toSeconds(9000), 9);
ctx.is(__1.toSeconds(9000.1982), 9);
ctx.is(__1.toSeconds(0.1982), 0);
ctx.is(__1.toSeconds('10000.124'), 10);
});
spec.test('handles non-numeric and other invalid values', (ctx) => {
ctx.is(__1.toSeconds('foo'), 0);
ctx.is(__1.toSeconds(null), 0);
ctx.is(__1.toSeconds(undefined), 0);
});
exports.default = spec;
//# sourceMappingURL=to-seconds.test.js.map
;