moy-fp
Version:
A functional programming library.
24 lines (20 loc) • 457 B
JavaScript
import __ from '../../src/Function/__'
/**
* Number -> [a] -> a | undefined
*/
import nthList from '../../src/List/nthList'
test('nthList(not using __), positive number', () => {
expect(
nthList(1)([1, 2, 3, 4])
).toBe(2)
})
test('nthList(not using __), negative number', () => {
expect(
nthList(-2)([1, 2, 3, 4])
).toBe(3)
})
test('nthList(using __), positive number', () => {
expect(
nthList(__, [1, 2, 3, 4])(1)
).toBe(2)
})