()
| 134 | } |
| 135 | |
| 136 | async function testPushWithTransforms() { |
| 137 | const upper = (chunks) => { |
| 138 | if (chunks === null) return null; |
| 139 | return chunks.map((c) => { |
| 140 | const str = new TextDecoder().decode(c); |
| 141 | return new TextEncoder().encode(str.toUpperCase()); |
| 142 | }); |
| 143 | }; |
| 144 | |
| 145 | const { writer, readable } = push(upper); |
| 146 | |
| 147 | writer.write('hello'); |
| 148 | writer.end(); |
| 149 | |
| 150 | const data = await text(readable); |
| 151 | assert.strictEqual(data, 'HELLO'); |
| 152 | } |
| 153 | |
| 154 | async function testInvalidBackpressure() { |
| 155 | assert.throws(() => push({ backpressure: 'banana' }), { |
no test coverage detected
searching dependent graphs…