deno.land / std@0.224.0 / streams / early_zip_readable_streams_test.ts

early_zip_readable_streams_test.ts
نووسراو ببینە
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
import { earlyZipReadableStreams } from "./early_zip_readable_streams.ts";import { assertEquals } from "../assert/mod.ts";
Deno.test("earlyZipReadableStreams() handles short first", async () => { const textStream = ReadableStream.from(["1", "2", "3"]); const textStream2 = ReadableStream.from(["a", "b", "c", "d", "e"]);
const buf = await Array.fromAsync( earlyZipReadableStreams(textStream, textStream2), );
assertEquals(buf, [ "1", "a", "2", "b", "3", "c", ]);});
Deno.test("earlyZipReadableStreams() handles long first", async () => { const textStream = ReadableStream.from(["a", "b", "c", "d", "e"]); const textStream2 = ReadableStream.from(["1", "2", "3"]);
const buf = await Array.fromAsync( earlyZipReadableStreams(textStream, textStream2), );
assertEquals(buf, [ "a", "1", "b", "2", "c", "3", "d", ]);});
std

Version Info

Tagged at
3 weeks ago