Skip to main content
Home

Built and signed on GitHub Actions

Well-tested utility functions dealing with async iterables

This package works with Cloudflare Workers, Node.js, Deno, Bun, Browsers
This package works with Cloudflare Workers
This package works with Node.js
This package works with Deno
This package works with Bun
This package works with Browsers
JSR Score
88%
Published
2 years ago (0.6.0)
function assertStreamStartsWith
assertStreamStartsWith<T>(
actual: AsyncIterable<T>,
expected: T[],
msg?: string,
): Promise<void>

Makes an assertion that the beginning elements of the actual iterable are in common with the elements of the expected array.

import { assertStreamStartsWith } from "./testing.ts";
import { count } from "./infinite.ts";

Deno.test("your test name", async () => {
  const stream = count(0, 5);
  await assertStreamStartsWith(stream, [0, 5, 10, 15]);
});

Type Parameters

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

Parameters

actual: AsyncIterable<T>

The async iterable to compare. It can be either finite or infinite.

expected: T[]

The array that contains the expected beginning elements.

optional
msg: string

Optional string message to display if the assertion fails.

Return Type

Promise<void>

New Ticket: Report package

Please provide a reason for reporting this package. We will review your report and take appropriate action.

Please review the JSR usage policy before submitting a report.

Add Package

deno add jsr:@hongminhee/aitertools

Import symbol

import { assertStreamStartsWith } from "@hongminhee/aitertools";
or

Import directly with a jsr specifier

import { assertStreamStartsWith } from "jsr:@hongminhee/aitertools";

Add Package

pnpm i jsr:@hongminhee/aitertools
or (using pnpm 10.8 or older)
pnpm dlx jsr add @hongminhee/aitertools

Import symbol

import { assertStreamStartsWith } from "@hongminhee/aitertools";

Add Package

yarn add jsr:@hongminhee/aitertools
or (using Yarn 4.8 or older)
yarn dlx jsr add @hongminhee/aitertools

Import symbol

import { assertStreamStartsWith } from "@hongminhee/aitertools";

Add Package

vlt install jsr:@hongminhee/aitertools

Import symbol

import { assertStreamStartsWith } from "@hongminhee/aitertools";

Add Package

npx jsr add @hongminhee/aitertools

Import symbol

import { assertStreamStartsWith } from "@hongminhee/aitertools";

Add Package

bunx jsr add @hongminhee/aitertools

Import symbol

import { assertStreamStartsWith } from "@hongminhee/aitertools";