moy-fp
Version:
A functional programming library.
36 lines (30 loc) • 781 B
JavaScript
import __ from '../../src/Function/__'
/**
* a -> [a] -> Number
*/
import indexOf from '../../src/List/indexOf'
test('indexOf(not using __), not reference type, contains', () => {
expect(
indexOf(3)([1, 2, 3, 4])
).toBe(2)
})
test('indexOf(not using __), not reference type, not contains', () => {
expect(
indexOf(5)([1, 2, 3, 4])
).toBe(-1)
})
test('indexOf(not using __), reference type, contains', () => {
expect(
indexOf({a: 3})([{a: 1}, {a: 2}, {a: 3}, {a: 4}])
).toBe(2)
})
test('indexOf(not using __), reference type, not contains', () => {
expect(
indexOf({a: 5})([{a: 1}, {a: 2}, {a: 3}, {a: 4}])
).toBe(-1)
})
test('indexOf(using __), not reference type, contains', () => {
expect(
indexOf(__, [1, 2, 3, 4])(3)
).toBe(2)
})