Skip to content

Commit

Permalink
[Tests] add cases for Infinities; increase coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
ljharb committed Aug 20, 2021
1 parent 6b9167b commit 5158d4d
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
20 changes: 20 additions & 0 deletions test/implementation.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
'use strict';

var implementation = require('../implementation');
var callBind = require('es-abstract/helpers/callBind');
var test = require('tape');
var hasStrictMode = require('has-strict-mode')();
var runTests = require('./tests');

test('as a function', function (t) {
t.test('bad first arg/receiver', { skip: !hasStrictMode }, function (st) {
/* eslint no-useless-call: 0 */
st['throws'](function () { implementation.call(undefined); }, TypeError, 'undefined is not an object');
st['throws'](function () { implementation.call(null); }, TypeError, 'null is not an object');
st.end();
});

runTests(callBind(implementation), t);

t.end();
});
3 changes: 3 additions & 0 deletions test/tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ module.exports = function (at, t) {
st.equal(at(arr, 3), undefined);
st.equal(at(arr, -4), undefined);

st.equal(at(arr, Infinity), undefined);
st.equal(at(arr, -Infinity), undefined);

st.equal(at([], 0), undefined);
st.equal(at([], -1), undefined);

Expand Down

0 comments on commit 5158d4d

Please sign in to comment.