deno.land / x / froebel@v0.23.2 / batch.test.ts

نووسراو ببینە
1
2
3
4
5
6
7
8
9
10
11
12
13
14
import batch from "./batch.ts";import { assertEquals, assertThrows } from "testing/asserts.ts";
Deno.test("batch", () => { assertEquals(batch([1, 2, 3, 4, 5], 2), [[1, 2], [3, 4], [5]]); assertEquals(batch([1, 2, 3, 4, 5], 6), [[1, 2, 3, 4, 5]]); assertEquals(batch([1, 2, 3, 4], 2), [[1, 2], [3, 4]]); assertEquals(batch([], 5), []); assertEquals(batch([1, 2], Infinity), [[1, 2]]); assertThrows(() => batch([1, 2], 0), RangeError); assertThrows(() => batch([1, 2], -1), RangeError); assertThrows(() => batch([1, 2], NaN), RangeError);});
froebel

Version Info

Tagged at
a year ago