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-descriptor.js
More file actions
25 lines (22 loc) · 1 KB
/
Copy pathes.object.get-own-property-descriptor.js
File metadata and controls
25 lines (22 loc) · 1 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
import { DESCRIPTORS } from '../helpers/constants';
import getOwnPropertyDescriptor from 'core-js-pure/es/object/get-own-property-descriptor';
QUnit.test('Object.getOwnPropertyDescriptor', assert => {
assert.isFunction(getOwnPropertyDescriptor);
assert.arity(getOwnPropertyDescriptor, 2);
assert.deepEqual(getOwnPropertyDescriptor({ q: 42 }, 'q'), {
writable: true,
enumerable: true,
configurable: true,
value: 42,
});
assert.same(getOwnPropertyDescriptor({}, 'toString'), undefined);
const primitives = [42, 'foo', false];
for (const value of primitives) {
assert.notThrows(() => getOwnPropertyDescriptor(value) || true, `accept ${ typeof value }`);
}
assert.throws(() => getOwnPropertyDescriptor(null), TypeError, 'throws on null');
assert.throws(() => getOwnPropertyDescriptor(undefined), TypeError, 'throws on undefined');
});
QUnit.test('Object.getOwnPropertyDescriptor.sham flag', assert => {
assert.same(getOwnPropertyDescriptor.sham, DESCRIPTORS ? undefined : true);
});