()
| 65 | // ============================================================================= |
| 66 | |
| 67 | async function testBackpressureAsync() { |
| 68 | let batchCount = 0; |
| 69 | async function* gen() { |
| 70 | for (let i = 0; i < 10; i++) { |
| 71 | batchCount++; |
| 72 | yield [Buffer.from(`chunk${i}`)]; |
| 73 | } |
| 74 | } |
| 75 | |
| 76 | const readable = toReadable(gen(), { highWaterMark: 1 }); |
| 77 | |
| 78 | // Read one chunk at a time with delays to exercise backpressure |
| 79 | const chunks = []; |
| 80 | for await (const chunk of readable) { |
| 81 | chunks.push(chunk); |
| 82 | } |
| 83 | |
| 84 | assert.strictEqual(chunks.length, 10); |
| 85 | assert.strictEqual(batchCount, 10); |
| 86 | } |
| 87 | |
| 88 | // ============================================================================= |
| 89 | // fromStreamIter: source error mid-stream |
no test coverage detected