summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/Array/fromAsync/returned-promise-resolves-to-array.js
blob: b6ccf790af3d842e2bd945b311646177e57288b5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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");
});