@xlink-network/xlink-sdk
Version:
28 lines (25 loc) • 866 B
JavaScript
;
// src/utils/bigintHelpers.spec.ts
var import_vitest = require("vitest");
// src/utils/bigintHelpers.ts
var MAX_BIGINT = BigInt(Number.MAX_VALUE);
function sum(nums) {
return nums.reduce((acc, val) => acc + val, 0n);
}
function max(nums) {
return nums.reduce((acc, val) => acc > val ? acc : val, 0n);
}
// src/utils/bigintHelpers.spec.ts
(0, import_vitest.describe)("bigintHelpers", () => {
(0, import_vitest.describe)("sum", () => {
(0, import_vitest.it)("should return the sum of an array of bigints", () => {
(0, import_vitest.expect)(sum([1n, 2n, 3n])).toBe(6n);
});
});
(0, import_vitest.describe)("max", () => {
(0, import_vitest.it)("should return the max of an array of bigints", () => {
(0, import_vitest.expect)(max([1n, 2n, 3n])).toBe(3n);
});
});
});
//# sourceMappingURL=bigintHelpers.spec.js.map