forked from tc39/test262
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patharg-is-function.js
More file actions
40 lines (33 loc) · 1.26 KB
/
arg-is-function.js
File metadata and controls
40 lines (33 loc) · 1.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// Copyright (C) 2026 Danial Asaria (Bloomberg LP). All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-promise.allkeyed
description: >
Promise.allKeyed accepts a function argument with enumerable own properties
info: |
Promise.allKeyed ( promises )
...
5. If promises is not an Object, then
a. ...Reject...
...
Functions are objects, so they pass the type check. Only own enumerable
properties are traversed; built-in function properties (name, length,
prototype) are non-enumerable by default and should be excluded.
includes: [asyncHelpers.js]
flags: [async]
features: [await-dictionary]
---*/
function fn() {}
fn.key = Promise.resolve('val');
asyncTest(function() {
return Promise.allKeyed(fn).then(function(result) {
assert.sameValue(Object.getPrototypeOf(result), null);
var keys = Reflect.ownKeys(result);
assert.sameValue(keys.length, 1);
assert.sameValue(keys[0], 'key');
assert.sameValue(result.key, 'val');
assert.sameValue(Object.prototype.hasOwnProperty.call(result, 'name'), false);
assert.sameValue(Object.prototype.hasOwnProperty.call(result, 'length'), false);
assert.sameValue(Object.prototype.hasOwnProperty.call(result, 'prototype'), false);
});
});