Debian Codegraph @

js/src/tests/test262/built-ins/Array/fromAsync/non-iterable-with-thenable-then-method-err.js

raw
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: Non-iterable input with thenable result promise is rejected if element's then method throws.
8 includes: [asyncHelpers.js]
9 flags: [async]
10 features: [Array.fromAsync]
11 ---*/
12
13 asyncTest(async function () {
14 const inputThenable = {
15 then (resolve, reject) {
16 throw new Test262Error;
17 },
18 };
19 const input = {
20 length: 1,
21 0: inputThenable,
22 };
23 const outputPromise = Array.fromAsync(input);
24 assert.throwsAsync(Test262Error, () => outputPromise);
25 });