batch-iterable
Version:
An abstraction to work with iterables of asyncIterables
42 lines (35 loc) • 919 B
JavaScript
import test from "node:test"
import assert from "node:assert"
import { BatchIterable } from "../index.js"
test("drop skips the first n elements", async () => {
const array = new BatchIterable([
[ ],
[ ],
])
const result = await array.drop(2).toArray()
assert.deepStrictEqual(
result,
[ ],
"Dropped elements should match expected output",
)
})
test("drop skips the first 0 elements", async () => {
const array = new BatchIterable([
[ ],
[ ],
])
const result = await array.drop(0).toArray()
assert.deepStrictEqual(
result,
[ ],
"Dropped elements should match expected output",
)
})
test("drop skips the first many elements", async () => {
const array = new BatchIterable([
[ ],
[ ],
])
const result = await array.drop(10).toArray()
assert.deepStrictEqual(result, [], "Dropped all elements")
})