| 39 | } |
| 40 | |
| 41 | async function testWriteWithSignalRejects() { |
| 42 | const { writer, readable } = push({ highWaterMark: 1 }); |
| 43 | |
| 44 | // Fill the buffer so write will block |
| 45 | writer.writeSync('a'); |
| 46 | |
| 47 | const ac = new AbortController(); |
| 48 | const writePromise = writer.write('b', { signal: ac.signal }); |
| 49 | |
| 50 | // Signal fires while write is pending |
| 51 | ac.abort(); |
| 52 | |
| 53 | await assert.rejects(writePromise, { name: 'AbortError' }); |
| 54 | |
| 55 | // Clean up |
| 56 | writer.end(); |
| 57 | // eslint-disable-next-line no-unused-vars |
| 58 | for await (const _ of readable) { break; } |
| 59 | } |
| 60 | |
| 61 | async function testWriteWithPreAbortedSignal() { |
| 62 | const { writer, readable } = push({ highWaterMark: 1 }); |