UNPKG

ts-prime

Version:

A utility library for JavaScript and Typescript.

32 lines (31 loc) 904 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var chunk_1 = require("./chunk"); describe('data first', function () { test('equal size', function () { expect(chunk_1.chunk(['a', 'b', 'c', 'd'], 2)).toEqual([ ['a', 'b'], ['c', 'd'], ]); }); test('not equal size', function () { expect(chunk_1.chunk(['a', 'b', 'c', 'd'], 3)).toEqual([ ['a', 'b', 'c'], ['d'], ]); }); test('1 element', function () { expect(chunk_1.chunk(['x'], 3)).toEqual([['x']]); }); test('empty array', function () { expect(chunk_1.chunk([], 3)).toEqual([]); }); }); describe('data last', function () { test('equal size', function () { expect(chunk_1.chunk(2)(['a', 'b', 'c', 'd'])).toEqual([ ['a', 'b'], ['c', 'd'], ]); }); });