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

Function testMergeStringSources

test/parallel/test-stream-iter-consumers-merge.js:155–166  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

153
154// merge() accepts string sources (normalized via from())
155async function testMergeStringSources() {
156 const batches = [];
157 for await (const batch of merge('hello', 'world')) {
158 batches.push(batch);
159 }
160 // Each string becomes a single-batch source
161 assert.strictEqual(batches.length >= 2, true);
162 const combined = new TextDecoder().decode(Buffer.concat(batches.flat()));
163 // Both strings should appear (order may vary)
164 assert.ok(combined.includes('hello'));
165 assert.ok(combined.includes('world'));
166}
167
168// merge() accepts object-like sources that are normalized via from()
169async function testMergeObjectLikeSources() {

Calls 6

concatMethod · 0.80
includesMethod · 0.80
decodeMethod · 0.65
mergeFunction · 0.50
pushMethod · 0.45
okMethod · 0.45

Tested by

no test coverage detected