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

Function testDropOldest

test/parallel/test-stream-iter-broadcast-backpressure.js:12–27  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

10// =============================================================================
11
12async function testDropOldest() {
13 const { writer, broadcast: bc } = broadcast({
14 highWaterMark: 2,
15 backpressure: 'drop-oldest',
16 });
17 const consumer = bc.push();
18
19 writer.writeSync('first');
20 writer.writeSync('second');
21 // This should drop 'first'
22 writer.writeSync('third');
23 writer.endSync();
24
25 const data = await text(consumer);
26 assert.strictEqual(data, 'secondthird');
27}
28
29async function testDropNewest() {
30 const { writer, broadcast: bc } = broadcast({

Calls 5

broadcastFunction · 0.50
textFunction · 0.50
pushMethod · 0.45
writeSyncMethod · 0.45
endSyncMethod · 0.45

Tested by

no test coverage detected