ts-prime
Version:
A utility library for JavaScript and Typescript.
24 lines (23 loc) • 748 B
JavaScript
import { pipe } from './pipe';
import { drop } from './drop';
import { createCounter } from './_counter';
import { take } from './take';
var array = [1, 2, 3, 4, 5];
var expected = [3, 4, 5];
describe('data first', function () {
test('should drop last', function () {
expect(drop(array, 2)).toEqual(expected);
});
});
describe('data last', function () {
test('drop', function () {
var result = pipe(array, drop(2));
expect(result).toEqual(expected);
});
test('drop with take', function () {
var counter = createCounter();
var result = pipe(array, counter.fn(), drop(2), take(2));
expect(counter.count).toHaveBeenCalledTimes(4);
expect(result).toEqual([3, 4]);
});
});