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