moy-fp
Version:
A functional programming library.
24 lines (20 loc) • 570 B
JavaScript
import __ from '../../src/Function/__'
/**
* [b] -> [a] -> [[a, b]]
*/
import zip from '../../src/List/zip'
test('zip(not using __), the same length of two list', () => {
expect(
zip([1, 2, 3])(['a', 'b', 'c'])
).toEqual([['a', 1], ['b', 2], ['c', 3]])
})
test('zip(not using __), not the same length of two list', () => {
expect(
zip([1, 2, 3])(['a', 'b'])
).toEqual([['a', 1], ['b', 2]])
})
test('zip(using __), the same length of two list', () => {
expect(
zip(__, ['a', 'b', 'c'])([1, 2, 3])
).toEqual([['a', 1], ['b', 2], ['c', 3]])
})