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"
    );
  });
});
