diff options
author | Minteck <contact@minteck.org> | 2021-12-21 16:52:28 +0100 |
---|---|---|
committer | Minteck <contact@minteck.org> | 2021-12-21 16:52:28 +0100 |
commit | 46e43f4bde4a35785b4997b81e86cd19f046b69b (patch) | |
tree | c53c2f826f777f9d6b2d249dab556feb72a6c3a6 /src/node_modules/is-nan/test/tests.js | |
download | langdetect-46e43f4bde4a35785b4997b81e86cd19f046b69b.tar.gz langdetect-46e43f4bde4a35785b4997b81e86cd19f046b69b.tar.bz2 langdetect-46e43f4bde4a35785b4997b81e86cd19f046b69b.zip |
Commit
Diffstat (limited to 'src/node_modules/is-nan/test/tests.js')
-rw-r--r-- | src/node_modules/is-nan/test/tests.js | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/src/node_modules/is-nan/test/tests.js b/src/node_modules/is-nan/test/tests.js new file mode 100644 index 0000000..cd6a500 --- /dev/null +++ b/src/node_modules/is-nan/test/tests.js @@ -0,0 +1,40 @@ +'use strict'; + +module.exports = function (numberIsNaN, t) { + t.test('not NaN', function (st) { + st.test('primitives', function (sst) { + sst.notOk(numberIsNaN(), 'undefined is not NaN'); + sst.notOk(numberIsNaN(null), 'null is not NaN'); + sst.notOk(numberIsNaN(false), 'false is not NaN'); + sst.notOk(numberIsNaN(true), 'true is not NaN'); + sst.notOk(numberIsNaN(0), 'positive zero is not NaN'); + sst.notOk(numberIsNaN(Infinity), 'Infinity is not NaN'); + sst.notOk(numberIsNaN(-Infinity), '-Infinity is not NaN'); + sst.notOk(numberIsNaN('foo'), 'string is not NaN'); + sst.notOk(numberIsNaN('NaN'), 'string NaN is not NaN'); + sst.end(); + }); + + st.notOk(numberIsNaN([]), 'array is not NaN'); + st.notOk(numberIsNaN({}), 'object is not NaN'); + st.notOk(numberIsNaN(function () {}), 'function is not NaN'); + + st.test('valueOf', function (vt) { + var obj = { + valueOf: function () { + return NaN; + } + }; + vt.ok(numberIsNaN(Number(obj)), 'object with valueOf of NaN, converted to Number, is NaN'); + vt.notOk(numberIsNaN(obj), 'object with valueOf of NaN is not NaN'); + vt.end(); + }); + + st.end(); + }); + + t.test('NaN literal', function (st) { + st.ok(numberIsNaN(NaN), 'NaN is NaN'); + st.end(); + }); +}; |