mirror of
https://github.com/hanzoai/core-js.git
synced 2026-09-24 16:58:15 +00:00
28 lines
1002 B
JavaScript
28 lines
1002 B
JavaScript
import { DESCRIPTORS } from '../helpers/constants.js';
|
|
|
|
QUnit.test('Object.defineProperties', assert => {
|
|
const { defineProperties } = Object;
|
|
assert.isFunction(defineProperties);
|
|
assert.arity(defineProperties, 2);
|
|
assert.name(defineProperties, 'defineProperties');
|
|
assert.looksNative(defineProperties);
|
|
assert.nonEnumerable(Object, 'defineProperties');
|
|
const source = {};
|
|
const result = defineProperties(source, { q: { value: 42 }, w: { value: 33 } });
|
|
assert.same(result, source);
|
|
assert.same(result.q, 42);
|
|
assert.same(result.w, 33);
|
|
|
|
if (DESCRIPTORS) {
|
|
// eslint-disable-next-line prefer-arrow-callback -- required for testing
|
|
assert.same(defineProperties(function () { /* empty */ }, { prototype: {
|
|
value: 42,
|
|
writable: false,
|
|
} }).prototype, 42, 'function prototype with non-writable descriptor');
|
|
}
|
|
});
|
|
|
|
QUnit.test('Object.defineProperties.sham flag', assert => {
|
|
assert.same(Object.defineProperties.sham, DESCRIPTORS ? undefined : true);
|
|
});
|