moy-fp
Version:
A functional programming library.
24 lines (20 loc) • 653 B
JavaScript
import __ from '../../src/Function/__'
/**
* [a] -> [a]
*/
import uniq from '../../src/List/uniq'
test('uniq(not using __), not mix item type', () => {
expect(
uniq([{a: 1}, {a: 2}, {a: 2}, {a: 3}, {a: 1}, {a: 4}, {a: 3}])
).toEqual([{a: 1}, {a: 2}, {a: 3}, {a: 4}])
})
test('uniq(not using __), mix item type', () => {
expect(
uniq([false, 0, {a: 1}, '0', 'o', 'false', {a: 1}, '0', 0, false, 'o'])
).toEqual([false, 0, {a: 1}, '0', 'o', 'false'])
})
test('uniq(using __), not mix item type', () => {
expect(
uniq(__)([{a: 1}, {a: 2}, {a: 2}, {a: 3}, {a: 1}, {a: 4}, {a: 3}])
).toEqual([{a: 1}, {a: 2}, {a: 3}, {a: 4}])
})