MCPcopy Create free account
hub / github.com/denoland/std / roundtrip

Function roundtrip

http/server_sent_event_parse_stream_test.ts:23–30  ·  view source on GitHub ↗

Helper to roundtrip through encode then decode

(
  messages: ServerSentEventMessage[],
)

Source from the content-addressed store, hash-verified

21
22/** Helper to roundtrip through encode then decode */
23function roundtrip(
24 messages: ServerSentEventMessage[],
25): ReadableStream<ServerSentEventParsedMessage> {
26 return ReadableStream
27 .from(messages)
28 .pipeThrough(new ServerSentEventStream())
29 .pipeThrough(new ServerSentEventParseStream());
30}
31
32Deno.test("ServerSentEventParseStream parses data field", async () => {
33 const result = await Array.fromAsync(parseStream([

Calls 1

fromMethod · 0.45

Tested by

no test coverage detected