UNPKG

@akashicpay/sdk

Version:

SDK to interact with the Akashic ecosystem

18 lines 669 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const async_1 = require("./async"); async function delay(timeout) { await new Promise((resolve) => setTimeout(resolve, timeout)); } describe('promiseAny', () => { it.each([{ values: [1, 2, 3] }, { values: [3, 2, 1] }])('resolves with the first resolved value', async ({ values }) => { const result = await (0, async_1.promiseAny)(values.map(async (v) => { if (v === 1) throw new Error('1 is bad'); await delay(v * 10); return v; })); expect(result).toBe(2); }); }); //# sourceMappingURL=async.spec.js.map