moy-fp
Version:
A functional programming library.
24 lines (20 loc) • 439 B
JavaScript
import __ from '../../src/Function/__'
/**
* [a] -> a | undefined
*/
import lastList from '../../src/List/lastList'
test('lastList(not using __), not empty array', () => {
expect(
lastList([1, 2, 3, 4])
).toBe(4)
})
test('lastList(not using __), empty array', () => {
expect(
lastList([])
).toBeUndefined()
})
test('lastList(using __), not empty array', () => {
expect(
lastList(__)([1, 2, 3, 4])
).toBe(4)
})