wundertec-core
Version:
Librería estándar de utilidades e integraciones AWS + helpers generales
14 lines (11 loc) • 360 B
text/typescript
import { chunk } from "../../src/collections/chunk";
describe("chunk()", () => {
it("splits array into chunks of given size", () => {
expect(chunk([1, 2, 3, 4, 5], 2)).toEqual([[1, 2], [3, 4], [5]]);
});
it("throws error if size <= 0", () => {
expect(() => chunk([1, 2, 3], 0)).toThrow(
"Size must be a positive integer"
);
});
});