tsoid
Version:
Typed functional library to deal with async operations.
21 lines (20 loc) • 720 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const curry_1 = require("../curry");
describe('curry', () => {
it('Should curry a sum function', () => {
const sum = (a, b) => a + b;
const sum10 = curry_1.default(sum)(10);
expect(sum10(10)).toBe(20);
});
it('Should curry a 3-arity function', () => {
const sum = (a, b, c) => a + b + c;
const csum = curry_1.curry3(sum);
expect(csum(1)(2)(3)).toBe(sum(1, 2, 3));
});
it('Should curry a 4-arity function', () => {
const sum = (a, b, c, d) => a + b + c + d;
const csum = curry_1.curry4(sum);
expect(csum(1)(2)(3)(4)).toBe(sum(1, 2, 3, 4));
});
});