UNPKG

@qntm-code/utils

Version:

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

16 lines (15 loc) 512 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const src_1 = require("../../src"); describe('asyncForEach', () => { it('should wait for the loop to finish before resolving the promise', async () => { let result = 0; await (0, src_1.asyncForEach)([10, 20, 30], value => { return new Promise(resolve => { result += value; setTimeout(resolve, 10); }); }); expect(result).toBe(60); }); });