Skip to content

Commit 4d577da

Browse files
committed
sync some global and pure tests
1 parent 2ab48b2 commit 4d577da

File tree

3 files changed

+21
-9
lines changed

3 files changed

+21
-9
lines changed

tests/unit-pure/es.array.fill.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { STRICT } from '../helpers/constants.js';
1+
import { DESCRIPTORS, STRICT } from '../helpers/constants.js';
22

33
import fill from 'core-js-pure/es/array/fill';
44

@@ -16,4 +16,14 @@ QUnit.test('Array#fill', assert => {
1616
assert.throws(() => fill(null, 0), TypeError);
1717
assert.throws(() => fill(undefined, 0), TypeError);
1818
}
19+
if (DESCRIPTORS) {
20+
// eslint-disable-next-line es/no-object-defineproperty -- required for testing
21+
assert.notThrows(() => fill(Object.defineProperty({
22+
length: -1,
23+
}, 0, {
24+
set() {
25+
throw new Error();
26+
},
27+
})), 'uses ToLength');
28+
}
1929
});

tests/unit-pure/es.array.find-index.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,11 @@ QUnit.test('Array#findIndex', assert => {
77
const array = [1];
88
const context = {};
99
findIndex(array, function (value, key, that) {
10-
assert.same(this, context);
11-
assert.same(value, 1);
12-
assert.same(key, 0);
13-
assert.same(that, array);
10+
assert.same(arguments.length, 3, 'correct number of callback arguments');
11+
assert.same(value, 1, 'correct value in callback');
12+
assert.same(key, 0, 'correct index in callback');
13+
assert.same(that, array, 'correct link to array in callback');
14+
assert.same(this, context, 'correct callback context');
1415
}, context);
1516
assert.same(findIndex([1, 3, NaN, 42, {}], it => it === 42), 3);
1617
assert.same(findIndex([1, 3, NaN, 42, {}], it => it === 43), -1);

tests/unit-pure/es.array.find.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,11 @@ QUnit.test('Array#find', assert => {
77
const array = [1];
88
const context = {};
99
find(array, function (value, key, that) {
10-
assert.same(this, context);
11-
assert.same(value, 1);
12-
assert.same(key, 0);
13-
assert.same(that, array);
10+
assert.same(arguments.length, 3, 'correct number of callback arguments');
11+
assert.same(value, 1, 'correct value in callback');
12+
assert.same(key, 0, 'correct index in callback');
13+
assert.same(that, array, 'correct link to array in callback');
14+
assert.same(this, context, 'correct callback context');
1415
}, context);
1516
assert.same(find([1, 3, NaN, 42, {}], it => it === 42), 42);
1617
assert.same(find([1, 3, NaN, 42, {}], it => it === 43), undefined);

0 commit comments

Comments
 (0)