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