Debian Codegraph @

js/src/tests/test262/built-ins/Array/fromAsync/sync-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: Result promise rejects if then method of input fails.
8 includes: [asyncHelpers.js]
9 flags: [async]
10 features: [Array.fromAsync]
11 ---*/
12
13 asyncTest(async function () {
14 const expectedValue = {};
15 const expected = [ expectedValue ];
16 const inputThenable = {
17 then (resolve, reject) {
18 throw new Test262Error();
19 },
20 };
21 const input = [ inputThenable ].values();
22 const output = Array.fromAsync(input);
23 await assert.throwsAsync(Test262Error, () => output);
24 });