ts-prime
Version:
A utility library for JavaScript and Typescript.
23 lines (22 loc) • 851 B
JavaScript
import { uniq } from './uniq';
import { pipe } from './pipe';
import { createCounter } from './_counter';
import { take } from './take';
it('uniq', function () {
expect(uniq([1, 2, 2, 5, 1, 6, 7])).toEqual([1, 2, 5, 6, 7]);
});
describe('pipe', function () {
it('uniq', function () {
var counter = createCounter();
var result = pipe([1, 2, 2, 5, 1, 6, 7], counter.fn(), uniq(), take(3));
expect(counter.count).toHaveBeenCalledTimes(4);
expect(result).toEqual([1, 2, 5]);
});
it('take before uniq', function () {
// bug from https://github.com/remeda/remeda/issues/14
var counter = createCounter();
var result = pipe([1, 2, 2, 5, 1, 6, 7], counter.fn(), take(3), uniq());
expect(counter.count).toHaveBeenCalledTimes(3);
expect(result).toEqual([1, 2]);
});
});