moy-fp
Version:
A functional programming library.
25 lines (21 loc) • 514 B
JavaScript
import __ from '../../src/Function/__'
/**
* Maybe m => b -> (a -> b) -> m a -> b
*/
import maybe from '../../src/Functor/maybe'
import Maybe from '../../src/Functor/Maybe/index'
test('maybe(not using __), null', () => {
expect(
maybe(1)(x => x + 1)(Maybe.of(null))
).toBe(1)
})
test('maybe(not using __), not null', () => {
expect(
maybe(1)(x => x + 1)(Maybe.of(12))
).toBe(13)
})
test('maybe(using __), not null', () => {
expect(
maybe(1, __, Maybe.of(12))(x => x + 1)
).toBe(13)
})