forked from zloirock/core-js
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathes.array.of.js
More file actions
27 lines (25 loc) · 757 Bytes
/
Copy pathes.array.of.js
File metadata and controls
27 lines (25 loc) · 757 Bytes
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
import { DESCRIPTORS } from '../helpers/constants';
import defineProperty from 'core-js-pure/es/object/define-property';
import of from 'core-js-pure/es/array/of';
QUnit.test('Array.of', assert => {
assert.isFunction(of);
assert.arity(of, 0);
assert.deepEqual(of(1), [1]);
assert.deepEqual(of(1, 2, 3), [1, 2, 3]);
class C { /* empty */ }
const instance = of.call(C, 1, 2);
assert.true(instance instanceof C);
assert.same(instance[0], 1);
assert.same(instance[1], 2);
assert.same(instance.length, 2);
if (DESCRIPTORS) {
let called = false;
defineProperty(C.prototype, 0, {
set() {
called = true;
},
});
of.call(C, 1, 2, 3);
assert.false(called, 'Should not call prototype accessors');
}
});