Skip to content

Commit 6804586

Browse files
committed
add some missed error types to assert.throws
1 parent ea510f0 commit 6804586

File tree

8 files changed

+14
-14
lines changed

8 files changed

+14
-14
lines changed

tests/unit-global/es.array.sort.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,8 @@ QUnit.test('Array#sort', assert => {
120120
assert.same([obj1, obj2].sort()[0], obj1, 'stable sort for equal string representations');
121121

122122
assert.notThrows(() => [1, 2, 3].sort(undefined).length === 3, 'works with undefined');
123-
assert.throws(() => [1, 2, 3].sort(null), 'throws on null');
124-
assert.throws(() => [1, 2, 3].sort({}), 'throws on {}');
123+
assert.throws(() => [1, 2, 3].sort(null), TypeError, 'throws on null');
124+
assert.throws(() => [1, 2, 3].sort({}), TypeError, 'throws on {}');
125125

126126
if (typeof Symbol == 'function' && !Symbol.sham) {
127127
assert.throws(() => [Symbol(1), Symbol(2)].sort(), 'w/o cmp throws on symbols');

tests/unit-global/es.array.to-sorted.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,8 @@ QUnit.test('Array#toSorted', assert => {
117117
assert.same(result, 'DGBEFHACIJK', 'stable #2');
118118

119119
assert.notThrows(() => [1, 2, 3].toSorted(undefined).length === 3, 'works with undefined');
120-
assert.throws(() => [1, 2, 3].toSorted(null), 'throws on null');
121-
assert.throws(() => [1, 2, 3].toSorted({}), 'throws on {}');
120+
assert.throws(() => [1, 2, 3].toSorted(null), TypeError, 'throws on null');
121+
assert.throws(() => [1, 2, 3].toSorted({}), TypeError, 'throws on {}');
122122

123123
if (typeof Symbol == 'function' && !Symbol.sham) {
124124
assert.throws(() => [Symbol(1), Symbol(2)].toSorted(), 'w/o cmp throws on symbols');

tests/unit-global/es.reflect.construct.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,6 @@ QUnit.test('Reflect.construct', assert => {
2323
assert.notThrows(() => getPrototypeOf(construct(B, [])) === Object.prototype);
2424
assert.notThrows(() => typeof construct(Date, []).getTime() == 'number', 'works with native constructors with 2 arguments');
2525
// eslint-disable-next-line prefer-arrow-callback -- testing
26-
assert.throws(() => construct(function () { /* empty */ }), 'throws when the second argument is not an object');
26+
assert.throws(() => construct(function () { /* empty */ }), TypeError, 'throws when the second argument is not an object');
2727
});
2828

tests/unit-global/es.typed-array.sort.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ if (DESCRIPTORS) QUnit.test('%TypedArrayPrototype%.sort', assert => {
5858

5959
assert.throws(() => sort.call([0], () => { /* empty */ }), "isn't generic");
6060
assert.notThrows(() => new TypedArray([1, 2, 3]).sort(undefined).length === 3, 'works with undefined');
61-
assert.throws(() => new TypedArray([1, 2, 3]).sort(null), 'throws on null');
62-
assert.throws(() => new TypedArray([1, 2, 3]).sort({}), 'throws on {}');
61+
assert.throws(() => new TypedArray([1, 2, 3]).sort(null), TypeError, 'throws on null');
62+
assert.throws(() => new TypedArray([1, 2, 3]).sort({}), TypeError, 'throws on {}');
6363
if (STRICT) {
6464
assert.throws(() => sort.call(null), TypeError, 'ToObject(this)');
6565
assert.throws(() => sort.call(undefined), TypeError, 'ToObject(this)');

tests/unit-global/es.typed-array.to-sorted.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ if (DESCRIPTORS) QUnit.test('%TypedArrayPrototype%.toSorted', assert => {
6161
}
6262

6363
assert.notThrows(() => new TypedArray([1, 2, 3]).toSorted(undefined).length === 3, 'works with undefined');
64-
assert.throws(() => new TypedArray([1, 2, 3]).toSorted(null), 'throws on null');
65-
assert.throws(() => new TypedArray([1, 2, 3]).toSorted({}), 'throws on {}');
64+
assert.throws(() => new TypedArray([1, 2, 3]).toSorted(null), TypeError, 'throws on null');
65+
assert.throws(() => new TypedArray([1, 2, 3]).toSorted({}), TypeError, 'throws on {}');
6666

6767
assert.throws(() => toSorted.call(null), TypeError, "isn't generic #1");
6868
assert.throws(() => toSorted.call(undefined), TypeError, "isn't generic #2");

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ import sort from 'core-js-pure/es/array/sort';
55
QUnit.test('Array#sort', assert => {
66
assert.isFunction(sort);
77
assert.notThrows(() => sort([1, 2, 3], undefined), 'works with undefined');
8-
assert.throws(() => sort([1, 2, 3], null), 'throws on null');
9-
assert.throws(() => sort([1, 2, 3], {}), 'throws on {}');
8+
assert.throws(() => sort([1, 2, 3], null), TypeError, 'throws on null');
9+
assert.throws(() => sort([1, 2, 3], {}), TypeError, 'throws on {}');
1010

1111
assert.deepEqual(sort([1, 3, 2]), [1, 2, 3], '#1');
1212
assert.deepEqual(sort([1, 3, 2, 11]), [1, 11, 2, 3], '#2');

tests/unit-pure/es.array.to-sorted.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,8 @@ QUnit.test('Array#toSorted', assert => {
113113
assert.same(result, 'DGBEFHACIJK', 'stable #2');
114114

115115
assert.notThrows(() => toSorted([1, 2, 3], undefined).length === 3, 'works with undefined');
116-
assert.throws(() => toSorted([1, 2, 3], null), 'throws on null');
117-
assert.throws(() => toSorted([1, 2, 3], {}), 'throws on {}');
116+
assert.throws(() => toSorted([1, 2, 3], null), TypeError, 'throws on null');
117+
assert.throws(() => toSorted([1, 2, 3], {}), TypeError, 'throws on {}');
118118

119119
if (typeof Symbol == 'function' && !Symbol.sham) {
120120
assert.throws(() => toSorted([Symbol(1), Symbol(2)]), 'w/o cmp throws on symbols');

tests/unit-pure/es.reflect.construct.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,5 @@ QUnit.test('Reflect.construct', assert => {
2424
assert.notThrows(() => getPrototypeOf(construct(B, [])) === Object.prototype);
2525
assert.notThrows(() => typeof construct(Date, []).getTime() == 'number', 'works with native constructors with 2 arguments');
2626
// eslint-disable-next-line prefer-arrow-callback -- testing
27-
assert.throws(() => construct(function () { /* empty */ }), 'throws when the second argument is not an object');
27+
assert.throws(() => construct(function () { /* empty */ }), TypeError, 'throws when the second argument is not an object');
2828
});

0 commit comments

Comments
 (0)