From 6f5534c45bbb36c00159bc5294e91a5ddc0d93db Mon Sep 17 00:00:00 2001 From: Hornwitser Date: Tue, 10 Sep 2019 00:50:09 +0200 Subject: [PATCH] Test for numeric strings in addItem and removeItem Add tests asserting that numeric strings passed to the addItem and removeItem methods to ItemDatabes throws. --- test/lib/database.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/test/lib/database.js b/test/lib/database.js index 512de4ad..8956fed3 100644 --- a/test/lib/database.js +++ b/test/lib/database.js @@ -176,6 +176,10 @@ describe("lib/database", function() { () => items.addItem('a', NaN), new Error("count must be a number") ); + assert.throws( + () => items.addItem('a', "1"), + new Error("count must be a number") + ); }); }); @@ -206,6 +210,10 @@ describe("lib/database", function() { () => items.removeItem('a', 'b'), new Error("count must be a number") ); + assert.throws( + () => items.removeItem('a', "1"), + new Error("count must be a number") + ); }); }); });