moy-fp
Version:
A functional programming library.
23 lines (20 loc) • 501 B
JavaScript
import __ from '../../src/Function/__'
/**
* (a -> Boolean) -> [a] -> Number
*/
import findIndex from '../../src/List/findIndex'
test('findIndex(not using __), satisfy pred', () => {
expect(
findIndex(x => x === 3)([1, 2, 3, 4])
).toBe(2)
})
test('findIndex(not using __), not satisfy pred', () => {
expect(
findIndex(x => x === 5)([1, 2, 3, 4])
).toBe(-1)
})
test('findIndex(using __), satisfy pred', () => {
expect(
findIndex(__, [1, 2, 3, 4])(x => x === 3)
).toBe(2)
})