asyncitems-null-undefined.js (664B)
1 // |reftest| async 2 // Copyright (C) 2022 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: > 8 Array.fromAsync rejects with a TypeError if the asyncItems argument is null or undefined 9 info: | 10 3.c. Let usingAsyncIterator be ? GetMethod(asyncItems, @@asyncIterator). 11 includes: [asyncHelpers.js] 12 flags: [async] 13 features: [Array.fromAsync] 14 ---*/ 15 16 asyncTest(async function () { 17 await assert.throwsAsync(TypeError, () => Array.fromAsync(null), "null asyncItems"); 18 await assert.throwsAsync(TypeError, () => Array.fromAsync(undefined), "undefined asyncItems"); 19 });