MCPcopy Index your code
hub / github.com/nodejs/node / testDropNewestCountsBytes

Function testDropNewestCountsBytes

test/parallel/test-stream-iter-writable-interop.js:241–256  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

239// =============================================================================
240
241async function testDropNewestCountsBytes() {
242 const writable = new Writable({
243 highWaterMark: 5,
244 write(chunk, enc, cb) {
245 // Never call cb
246 },
247 });
248
249 const writer = fromWritable(writable, { backpressure: 'drop-newest' });
250
251 await writer.write('12345'); // 5 bytes, accepted
252 await writer.write('67890'); // 5 bytes, dropped
253
254 // desiredSize should be 0 (buffer is full)
255 assert.strictEqual(writer.desiredSize, 0);
256}
257
258// =============================================================================
259// drop-oldest: throws on construction

Calls 2

fromWritableFunction · 0.85
writeMethod · 0.45

Tested by

no test coverage detected