forked from zloirock/core-js
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathes.array.unshift.js
More file actions
20 lines (15 loc) · 818 Bytes
/
Copy pathes.array.unshift.js
File metadata and controls
20 lines (15 loc) · 818 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import { REDEFINABLE_ARRAY_LENGTH_DESCRIPTOR, STRICT } from '../helpers/constants';
import unshift from 'core-js-pure/es/array/virtual/unshift';
import defineProperty from 'core-js-pure/es/object/define-property';
QUnit.test('Array#unshift', assert => {
assert.isFunction(unshift);
assert.same(unshift.call([1], 0), 2, 'proper result');
if (STRICT) {
if (REDEFINABLE_ARRAY_LENGTH_DESCRIPTOR) {
assert.throws(() => unshift.call(defineProperty([], 'length', { writable: false }), 1), TypeError, 'non-writable length, with arg');
assert.throws(() => unshift.call(defineProperty([], 'length', { writable: false })), TypeError, 'non-writable length, without arg');
}
assert.throws(() => unshift.call(null), TypeError);
assert.throws(() => unshift.call(undefined), TypeError);
}
});