diff --git a/2020/SameValueNonNumeric.js b/2020/SameValueNonNumeric.js index f7ef12c0..04f6cbfb 100644 --- a/2020/SameValueNonNumeric.js +++ b/2020/SameValueNonNumeric.js @@ -11,7 +11,7 @@ var Type = require('./Type'); module.exports = function SameValueNonNumeric(x, y) { var xType = Type(x); - if (xType === 'Number' || xType === 'Bigint') { + if (xType === 'Number' || xType === 'BigInt') { throw new $TypeError('Assertion failed: SameValueNonNumeric does not accept Number or BigInt values'); } if (xType !== Type(y)) { diff --git a/2021/SameValueNonNumeric.js b/2021/SameValueNonNumeric.js index f7ef12c0..04f6cbfb 100644 --- a/2021/SameValueNonNumeric.js +++ b/2021/SameValueNonNumeric.js @@ -11,7 +11,7 @@ var Type = require('./Type'); module.exports = function SameValueNonNumeric(x, y) { var xType = Type(x); - if (xType === 'Number' || xType === 'Bigint') { + if (xType === 'Number' || xType === 'BigInt') { throw new $TypeError('Assertion failed: SameValueNonNumeric does not accept Number or BigInt values'); } if (xType !== Type(y)) { diff --git a/2022/SameValueNonNumeric.js b/2022/SameValueNonNumeric.js index f7ef12c0..04f6cbfb 100644 --- a/2022/SameValueNonNumeric.js +++ b/2022/SameValueNonNumeric.js @@ -11,7 +11,7 @@ var Type = require('./Type'); module.exports = function SameValueNonNumeric(x, y) { var xType = Type(x); - if (xType === 'Number' || xType === 'Bigint') { + if (xType === 'Number' || xType === 'BigInt') { throw new $TypeError('Assertion failed: SameValueNonNumeric does not accept Number or BigInt values'); } if (xType !== Type(y)) { diff --git a/package.json b/package.json index a0fcdfc5..92f4dd5f 100644 --- a/package.json +++ b/package.json @@ -79,6 +79,7 @@ "devDependencies": { "@ljharb/eslint-config": "^21.0.0", "array.prototype.filter": "^1.0.1", + "array.prototype.flatmap": "^1.3.0", "array.prototype.indexof": "^1.0.4", "aud": "^2.0.0", "available-regexp-flags": "^1.0.0", diff --git a/test/tests.js b/test/tests.js index 720d1b7a..78c3b24e 100644 --- a/test/tests.js +++ b/test/tests.js @@ -6,6 +6,7 @@ var forEach = require('for-each'); var debug = require('object-inspect'); var assign = require('object.assign'); var keys = require('object-keys'); +var flatMap = require('array.prototype.flatmap'); var has = require('has'); var arrowFns = require('make-arrow-function').list(); var hasStrictMode = require('has-strict-mode')(); @@ -7444,9 +7445,19 @@ var es2020 = function ES2020(ES, ops, expectedMissing, skips) { [4, ''], ['abc', true], [{}, false] - ]; + ].concat(flatMap(v.bigints, function (bigint) { + return [ + [bigint, bigint], + [bigint, {}], + [{}, bigint], + [3, bigint], + [bigint, 3], + ['', bigint], + [bigint, ''] + ]; + })); forEach(willThrow, function (nums) { - t['throws'](function () { return ES.SameValueNonNumeric.apply(ES, nums); }, TypeError, 'value must be same type and non-number'); + t['throws'](function () { return ES.SameValueNonNumeric.apply(ES, nums); }, TypeError, 'value must be same type and non-number/bigint: got ' + debug(nums[0]) + ' and ' + debug(nums[1])); }); forEach(v.objects.concat(v.nonNumberPrimitives), function (val) {