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