From 5575009908e414976a8713f39a3c4760ccefe9f8 Mon Sep 17 00:00:00 2001 From: dfahlander Date: Fri, 23 Oct 2020 09:58:44 +0200 Subject: [PATCH] Repro of 1154 --- test/tests-whereclause.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/test/tests-whereclause.js b/test/tests-whereclause.js index deef54257..e9ea1b1be 100644 --- a/test/tests-whereclause.js +++ b/test/tests-whereclause.js @@ -843,3 +843,21 @@ promisedTest("Virtual Index", async () => { ], null, 2), "equalsIgnoreCase() should work with virtual indexes"); //equal(daves.length, 3, "There should be 3 davids in the result when using equalsIgnoreCase()"); }); + +promisedTest("WhereClause.equals(invalid key)", async () => { + await db.files.where("filename").equals(null).first().then(()=>{ + ok(false, "db.files.where('filename').equals(null) must fail but it didnt!"); + }).catch(error => { + ok(true, `db.files.where('filename').equals(null) failed as expected (with ${error})`); + }); + await db.files.where("filename").equals(undefined).first().then(()=>{ + ok(false, "db.files.where('filename').equals(undefined) must fail but it didnt!"); + }).catch(error => { + ok(true, `db.files.where('filename').equals(undefined) failed as expected (with ${error})`); + }); + await db.files.where("filename").equals(function(){}).first().then(()=>{ + ok(false, "db.files.where('filename').equals(function(){}) must fail but it didnt!"); + }).catch(error => { + ok(true, `db.files.where('filename').equals(function(){}) failed as expected (with ${error})`); + }); +});