Files
utils/tests/splitIntoChunks.test.ts
2024-03-12 21:23:19 +02:00

15 lines
400 B
TypeScript

import { expect, test } from "@jest/globals";
import { splitIntoChunks } from "../src";
test("splits an array into chunks", () => {
// JSON.stringify is being used because there is no way to compare nested arrays in jest
expect(
JSON.stringify(splitIntoChunks(["a", "b", "c", "d", "e", "f"], 3)),
).toBe(
JSON.stringify([
["a", "b", "c"],
["d", "e", "f"],
]),
);
});