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

Function testStrictRejectsWhenFull

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

Source from the content-addressed store, hash-verified

133// =============================================================================
134
135async function testStrictRejectsWhenFull() {
136 const writable = new Writable({
137 highWaterMark: 5,
138 write(chunk, enc, cb) {
139 // Never call cb -- data stays buffered
140 },
141 });
142
143 const writer = fromWritable(writable);
144
145 // First write fills the buffer (5 bytes = hwm)
146 await writer.write('12345');
147
148 // Second write should reject -- buffer is full
149 await assert.rejects(
150 writer.write('more'),
151 { code: 'ERR_INVALID_STATE' },
152 );
153}
154
155// =============================================================================
156// strict: writev rejects when buffer is full

Calls 2

fromWritableFunction · 0.85
writeMethod · 0.45

Tested by

no test coverage detected