Skip to content

Commit

Permalink
Add AsyncIterableOption trycatch tests
Browse files Browse the repository at this point in the history
  • Loading branch information
velocityzen committed May 8, 2024
1 parent be2912f commit 798fa2d
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions tests/AsyncIterableOption.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import * as T from "fp-ts/Task";
import { pipe } from "fp-ts/function";
import * as AIO from "../lib/AsyncIterableOption";
import {
createTestAsyncIterable,
createTestAsyncIterableWithError,
} from "./helpers";

describe("AsyncIterableEither", () => {
test("tryCatch with no error", async () => {
const test = pipe(
createTestAsyncIterable(),
AIO.tryCatch,
AIO.toArraySeq(),
T.map((values) =>
expect(values).toStrictEqual([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])
)
);

await test();
});

test("tryCatch with error", async () => {
const test = pipe(
createTestAsyncIterableWithError(),
AIO.tryCatch,
AIO.toArraySeq(),
T.map((values) => expect(values).toStrictEqual([0, 1, 2, 3, 4]))
);

await test();
});
});

0 comments on commit 798fa2d

Please sign in to comment.