Backed out 3 changesets (bug 1892041) for causing failures on async-module-does-not...
[gecko.git] / js / src / tests / test262 / built-ins / Array / fromAsync / non-iterable-input-with-thenable-async-mapped-callback-err.js
blobedc811b792c227d5270cfdad22da373633f13568
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.
5 /*---
6 esid: sec-array.fromasync
7 description: Non-iterable input with thenable result promise rejects if async map function callback throws. 
8 includes: [asyncHelpers.js]
9 flags: [async]
10 features: [Array.fromAsync]
11 ---*/
13 asyncTest(async function () {
14   const expectedValue = {};
15   const inputThenable = {
16     then (resolve, reject) {
17       resolve(expectedValue);
18     },
19   };
20   const input = {
21     length: 1,
22     0: inputThenable,
23   };
24   const outputPromise = Array.fromAsync(input, async v => {
25     throw new Test262Error;
26   });
27   assert.throwsAsync(Test262Error, () => outputPromise);
28 });