UNPKG

axax

Version:

A library of async iterator extensions for JavaScript including ```map```, ```reduce```, ```filter```, ```flatMap```, ```pipe``` and [more](https://github.com/jamiemccrindle/axax/blob/master/docs/API.md#functions).

37 lines (36 loc) 1.77 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const of_1 = require("../of"); const some_1 = require("../some"); test("some with inline predicate and with true as a result", async () => { const result = await some_1.some((value) => value % 2 === 0)(of_1.of(1, 2, 1)); expect(result).toEqual(true); }); test("some with inline predicate and with false as a result", async () => { const result = await some_1.some((value) => value % 2 === 0)(of_1.of(1, 3, 5)); expect(result).toEqual(false); }); test("some with Boolean predicate, number values, and with true as a result", async () => { const result = await some_1.some(Boolean)(of_1.of(0, 1, 0)); expect(result).toEqual(true); }); test("some with Boolean predicate, number values, and with false as a result", async () => { const result = await some_1.some(Boolean)(of_1.of(0, 0, 0)); expect(result).toEqual(false); }); test("some with Boolean predicate, array values, and with true as a result", async () => { const result = await some_1.some(Boolean)(of_1.of([], [1, 2, 3], [])); expect(result).toEqual(true); }); test("some with Boolean predicate, array values, and with false as a result", async () => { const result = await some_1.some(Boolean)(of_1.of([], [], [])); expect(result).toEqual(true); }); test("some with predicate and with true as a result : edge case scenario", async () => { const result = await some_1.some((value) => value % 2 === 0)(of_1.of(1, 3, 5, 7, 8)); expect(result).toEqual(true); }); test("some with predicate and with true as a result : edge case scenario", async () => { const result = await some_1.some((value) => value % 2 === 0)(of_1.of(2, 3, 5, 7, 9)); expect(result).toEqual(true); });