forked from zloirock/core-js
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathes.object.get-own-property-descriptors.js
More file actions
41 lines (38 loc) · 1.18 KB
/
Copy pathes.object.get-own-property-descriptors.js
File metadata and controls
41 lines (38 loc) · 1.18 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
41
import { DESCRIPTORS } from '../helpers/constants';
import Symbol from 'core-js-pure/es/symbol';
import create from 'core-js-pure/es/object/create';
import getOwnPropertyDescriptors from 'core-js-pure/es/object/get-own-property-descriptors';
QUnit.test('Object.getOwnPropertyDescriptors', assert => {
assert.isFunction(getOwnPropertyDescriptors);
const object = create({ q: 1 }, { e: { value: 3 } });
object.w = 2;
const symbol = Symbol('4');
object[symbol] = 4;
const descriptors = getOwnPropertyDescriptors(object);
assert.same(descriptors.q, undefined);
assert.deepEqual(descriptors.w, {
enumerable: true,
configurable: true,
writable: true,
value: 2,
});
if (DESCRIPTORS) {
assert.deepEqual(descriptors.e, {
enumerable: false,
configurable: false,
writable: false,
value: 3,
});
} else {
assert.deepEqual(descriptors.e, {
enumerable: true,
configurable: true,
writable: true,
value: 3,
});
}
assert.same(descriptors[symbol].value, 4);
});
QUnit.test('Object.getOwnPropertyDescriptors.sham flag', assert => {
assert.same(getOwnPropertyDescriptors.sham, DESCRIPTORS ? undefined : true);
});