diff options
Diffstat (limited to 'js/src/tests/test262/built-ins/Array/fromAsync/returned-promise-resolves-to-array.js')
-rw-r--r-- | js/src/tests/test262/built-ins/Array/fromAsync/returned-promise-resolves-to-array.js | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/js/src/tests/test262/built-ins/Array/fromAsync/returned-promise-resolves-to-array.js b/js/src/tests/test262/built-ins/Array/fromAsync/returned-promise-resolves-to-array.js new file mode 100644 index 0000000000..b6ccf790af --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/fromAsync/returned-promise-resolves-to-array.js @@ -0,0 +1,23 @@ +// |reftest| async +// Copyright (C) 2023 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-array.fromasync +description: > + Array.fromAsync returns a Promise that resolves to an Array in the normal case +info: | + 1. Let _C_ be the *this* value. + ... + 3.e. If IsConstructor(_C_) is *true*, then + i. Let _A_ be ? Construct(_C_). +features: [Array.fromAsync] +flags: [async] +includes: [asyncHelpers.js] +---*/ + +asyncTest(async function () { + const promise = Array.fromAsync([0, 1, 2]); + const array = await promise; + assert(Array.isArray(array), "Array.fromAsync returns a Promise that resolves to an Array"); +}); |