(chunks: unknown[])
| 179 | |
| 180 | describe("normalizeGatewayStreamUsage", () => { |
| 181 | async function collectStream(chunks: unknown[]): Promise<unknown[]> { |
| 182 | const stream = new ReadableStream({ |
| 183 | start(controller) { |
| 184 | for (const chunk of chunks) { |
| 185 | controller.enqueue(chunk); |
| 186 | } |
| 187 | controller.close(); |
| 188 | }, |
| 189 | }); |
| 190 | |
| 191 | const result: unknown[] = []; |
| 192 | const transformed: ReadableStream<unknown> = stream.pipeThrough(normalizeGatewayStreamUsage()); |
| 193 | const reader = transformed.getReader(); |
| 194 | for (;;) { |
| 195 | const chunk = await reader.read(); |
| 196 | if (chunk.done) break; |
| 197 | result.push(chunk.value); |
| 198 | } |
| 199 | return result; |
| 200 | } |
| 201 | |
| 202 | it("passes non-finish events through unchanged", async () => { |
| 203 | const chunks = [ |
no test coverage detected