( transform: TransformStream<T, U>, inputs: Iterable<T> | AsyncIterable<T>, outputs: Iterable<U> | AsyncIterable<U>, )
| 9 | * @param outputs Expected output data |
| 10 | */ |
| 11 | export async function testTransformStream<T, U>( |
| 12 | transform: TransformStream<T, U>, |
| 13 | inputs: Iterable<T> | AsyncIterable<T>, |
| 14 | outputs: Iterable<U> | AsyncIterable<U>, |
| 15 | ) { |
| 16 | const reader = ReadableStream.from(inputs) |
| 17 | .pipeThrough(transform) |
| 18 | .getReader(); |
| 19 | for await (const output of outputs) { |
| 20 | const { value, done } = await reader.read(); |
| 21 | assertEquals(value, output); |
| 22 | assertEquals(done, false); |
| 23 | } |
| 24 | const f = await reader.read(); |
| 25 | assert(f.done, `stream not done, value was: ${f.value}`); |
| 26 | } |
no test coverage detected