Skip to main content
Module

x/aitertools/mod.ts>assertStreams

Well-tested utility functions dealing with async iterables
Go to Latest
function assertStreams
import { assertStreams } from "https://deno.land/x/aitertools@0.4.0/mod.ts";

Makes an assertion that the elements of the actual iterable are equal to the elements of the expected array.

import { assertStreams } from "./testing.ts";

async function* gen() { yield "actual"; yield "elements"; }

Deno.test("your test name", async () => {
  const stream = gen();
  await assertStreams(stream, ["actual", "elements"]);
});

Type Parameters

T

The type of the elements in the actual async iterable and the expected array.

Parameters

actual: AsyncIterable<T>

The async iterable to compare. It must be finite.

expected: T[]

The array that contains the expected elements.

optional
msg: string

Optional string message to display if the assertion fails.

Returns

Promise<void>