MCPcopy Create free account
hub / github.com/nodejs/node / testMultiBatchAsync

Function testMultiBatchAsync

test/parallel/test-stream-iter-to-readable.js:46–61  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

44// =============================================================================
45
46async function testMultiBatchAsync() {
47 async function* gen() {
48 for (let i = 0; i < 5; i++) {
49 const batch = [];
50 for (let j = 0; j < 3; j++) {
51 batch.push(Buffer.from(`${i}-${j} `));
52 }
53 yield batch;
54 }
55 }
56
57 const readable = toReadable(gen());
58 const result = await collect(readable);
59 assert.strictEqual(result.toString(),
60 '0-0 0-1 0-2 1-0 1-1 1-2 2-0 2-1 2-2 3-0 3-1 3-2 4-0 4-1 4-2 ');
61}
62
63// =============================================================================
64// fromStreamIter: backpressure with small highWaterMark

Callers 1

Calls 4

toReadableFunction · 0.85
genFunction · 0.70
collectFunction · 0.70
toStringMethod · 0.45

Tested by

no test coverage detected