UNPKG

@qntm-code/utils

Version:

A collection of useful utility functions with associated TypeScript types. All functions have been unit tested.

18 lines (17 loc) 783 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const src_1 = require("../../src"); describe(`asyncEvery`, () => { it(`should return true if all items in the array match the predicate`, async () => { const result = await (0, src_1.asyncEvery)([1, 2, 3, 4, 5], value => { return new Promise(resolve => setTimeout(() => resolve(value % 2 === 0), 10)); }); expect(result).toBe(false); }); it(`should return false if not all items in the array match the predicate`, async () => { const result = await (0, src_1.asyncEvery)([2, 4, 6, 8, 10], value => { return new Promise(resolve => setTimeout(() => resolve(value % 2 === 0), 10)); }); expect(result).toBe(true); }); });