()
| 189 | // ============================================================================= |
| 190 | |
| 191 | async function testWithTransform() { |
| 192 | const readable = new Readable({ |
| 193 | read() { |
| 194 | this.push(Buffer.from('hello')); |
| 195 | this.push(null); |
| 196 | }, |
| 197 | }); |
| 198 | |
| 199 | // Uppercase transform |
| 200 | function uppercase(chunks) { |
| 201 | if (chunks === null) return null; |
| 202 | return chunks.map((c) => { |
| 203 | const buf = Buffer.from(c); |
| 204 | for (let i = 0; i < buf.length; i++) { |
| 205 | if (buf[i] >= 97 && buf[i] <= 122) buf[i] -= 32; |
| 206 | } |
| 207 | return buf; |
| 208 | }); |
| 209 | } |
| 210 | |
| 211 | const result = await text(pull(readable, uppercase)); |
| 212 | assert.strictEqual(result, 'HELLO'); |
| 213 | } |
| 214 | |
| 215 | // ============================================================================= |
| 216 | // Object-mode Readable: strings are normalized to Uint8Array |
no test coverage detected