forked from zloirock/core-js
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathes.array.fill.js
More file actions
19 lines (17 loc) · 807 Bytes
/
Copy pathes.array.fill.js
File metadata and controls
19 lines (17 loc) · 807 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import { STRICT } from '../helpers/constants';
import fill from 'core-js-pure/es/array/fill';
QUnit.test('Array#fill', assert => {
assert.isFunction(fill);
const array = fill(Array(5), 5);
assert.same(array, array);
assert.deepEqual(fill(Array(5), 5), [5, 5, 5, 5, 5]);
assert.deepEqual(fill(Array(5), 5, 1), [undefined, 5, 5, 5, 5]);
assert.deepEqual(fill(Array(5), 5, 1, 4), [undefined, 5, 5, 5, undefined]);
assert.deepEqual(fill(Array(5), 5, 6, 1), [undefined, undefined, undefined, undefined, undefined]);
assert.deepEqual(fill(Array(5), 5, -3, 4), [undefined, undefined, 5, 5, undefined]);
assert.arrayEqual(fill({ length: 5 }, 5), [5, 5, 5, 5, 5]);
if (STRICT) {
assert.throws(() => fill(null, 0), TypeError);
assert.throws(() => fill(undefined, 0), TypeError);
}
});