diff --git a/test/index.js b/test/index.js index 93cd315..3b2878c 100644 --- a/test/index.js +++ b/test/index.js @@ -72,3 +72,31 @@ test ('run non-global regex without result', (t) => { }); t.is (count, 0); }); + +test ('check isnil with undefined', (t) => { + t.is (util.is_nil (), true); +}); + +test ('check isnil with null', (t) => { + t.is (util.is_nil (null), true); +}); + +test ('check isnil with empty string', (t) => { + t.is (util.is_nil (''), false); +}); + +test ('check isnil with string', (t) => { + t.is (util.is_nil ('foo'), false); +}); + +test ('check isnil with 0', (t) => { + t.is (util.is_nil (0), false); +}); + +test ('check isnil with nan', (t) => { + t.is (util.is_nil (parseInt ('foo')), true); +}); + +test ('check isnil with int', (t) => { + t.is (util.is_nil (parseInt ('42')), false); +});