mirror of
https://github.com/hanzoai/core-js.git
synced 2026-09-24 16:58:15 +00:00
19 lines
830 B
JavaScript
19 lines
830 B
JavaScript
import { DESCRIPTORS } from '../helpers/constants.js';
|
|
|
|
QUnit.test('Reflect.getOwnPropertyDescriptor', assert => {
|
|
const { getOwnPropertyDescriptor } = Reflect;
|
|
assert.isFunction(getOwnPropertyDescriptor);
|
|
assert.arity(getOwnPropertyDescriptor, 2);
|
|
assert.name(getOwnPropertyDescriptor, 'getOwnPropertyDescriptor');
|
|
assert.looksNative(getOwnPropertyDescriptor);
|
|
assert.nonEnumerable(Reflect, 'getOwnPropertyDescriptor');
|
|
const object = { baz: 789 };
|
|
const descriptor = getOwnPropertyDescriptor(object, 'baz');
|
|
assert.same(descriptor.value, 789);
|
|
assert.throws(() => getOwnPropertyDescriptor(42, 'constructor'), TypeError, 'throws on primitive');
|
|
});
|
|
|
|
QUnit.test('Reflect.getOwnPropertyDescriptor.sham flag', assert => {
|
|
assert.same(Reflect.getOwnPropertyDescriptor.sham, DESCRIPTORS ? undefined : true);
|
|
});
|