Creates a function that returns the iterable values. Any iterable values that are errors will be thrown.
The type of each item of the iterable
The self type of the returned function
The arguments type of the returned function
The iterable values
A function that returns the iterable values
Rest
import { returnsNext } from "@std/testing/mock";import { assertEquals, assertThrows } from "@std/assert";const func = returnsNext([1, 2, new Error("foo"), 3]);assertEquals(func(), 1);assertEquals(func(), 2);assertThrows(() => func(), Error, "foo");assertEquals(func(), 3); Copy
import { returnsNext } from "@std/testing/mock";import { assertEquals, assertThrows } from "@std/assert";const func = returnsNext([1, 2, new Error("foo"), 3]);assertEquals(func(), 1);assertEquals(func(), 2);assertThrows(() => func(), Error, "foo");assertEquals(func(), 3);
Creates a function that returns the iterable values. Any iterable values that are errors will be thrown.