moy-fp
Version:
A functional programming library.
24 lines (20 loc) • 525 B
JavaScript
import __ from '../../src/Function/__'
/**
* (*... -> c) -> ((a, b) -> c)
*/
import binary from '../../src/Function/binary'
test('binary(not using __), original arity is 1', () => {
expect(
binary(x => [x, x + 1])(1)(2)
).toEqual([1, 2])
})
test('binary(not using __), original arities are 3', () => {
expect(
binary((x, y, z) => [x, y, z])(1)(2)
).toEqual([1, 2, undefined])
})
test('binary(using __), original arity is 1', () => {
expect(
binary(x => [x, x + 1])(__, 2)(1)
).toEqual([1, 2])
})