sync-iterable-input-with-thenable.js (585B)
1 // |reftest| async 2 // Copyright (C) 2023 Igalia, S.L. All rights reserved. 3 // This code is governed by the BSD license found in the LICENSE file. 4 5 /*--- 6 esid: sec-array.fromasync 7 description: Sync-iterable input with thenables is transferred to the output array. 8 includes: [compareArray.js, asyncHelpers.js] 9 flags: [async] 10 features: [Array.fromAsync] 11 ---*/ 12 13 asyncTest(async function () { 14 const expected = [ 0, 1, 2 ]; 15 const input = [ 0, Promise.resolve(1), Promise.resolve(2) ].values(); 16 const output = await Array.fromAsync(input); 17 assert.compareArray(output, expected); 18 });