Helper to parse SSE from raw string chunks
( chunks: string[], )
| 11 | |
| 12 | /** Helper to parse SSE from raw string chunks */ |
| 13 | function parseStream( |
| 14 | chunks: string[], |
| 15 | ): ReadableStream<ServerSentEventParsedMessage> { |
| 16 | const encoder = new TextEncoder(); |
| 17 | return ReadableStream |
| 18 | .from(chunks.map((chunk) => encoder.encode(chunk))) |
| 19 | .pipeThrough(new ServerSentEventParseStream()); |
| 20 | } |
| 21 | |
| 22 | /** Helper to roundtrip through encode then decode */ |
| 23 | function roundtrip( |
no test coverage detected