From 20c0c73a5ef1ee8f5910da1f4d29641920053c2c Mon Sep 17 00:00:00 2001 From: Timo Hocker Date: Tue, 28 Apr 2020 08:27:06 +0200 Subject: [PATCH] expand tests, kill mutants --- test/index.js | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) 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); +});