build: add jest, tests
This commit is contained in:
14
tests/splitIntoChunks.test.ts
Normal file
14
tests/splitIntoChunks.test.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
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"],
|
||||
]),
|
||||
);
|
||||
});
|
||||
Reference in New Issue
Block a user