summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2020-02-23 11:44:24 -0500
committertoasted-nutbread <toasted-nutbread@users.noreply.github.com>2020-02-23 11:44:24 -0500
commit0f9f2e446dd9c28fa67e4c73a2f573b4c57cfc04 (patch)
treed79e60a235eea47b467f8a0c838be0e6725c2b58 /test
parent897f2360be13db70ff2f533089ba8d38b0b744ed (diff)
Clear timer variable
Diffstat (limited to 'test')
-rw-r--r--test/test-database.js7
1 files changed, 5 insertions, 2 deletions
diff --git a/test/test-database.js b/test/test-database.js
index 44f409dd..add04a03 100644
--- a/test/test-database.js
+++ b/test/test-database.js
@@ -109,7 +109,8 @@ function countKanjiWithCharacter(kanji, character) {
function clearDatabase(timeout) {
return new Promise((resolve, reject) => {
- const timer = setTimeout(() => {
+ let timer = setTimeout(() => {
+ timer = null;
reject(new Error(`clearDatabase failed to resolve after ${timeout}ms`));
}, timeout);
@@ -122,7 +123,9 @@ function clearDatabase(timeout) {
request.onsuccess = () => resolve2();
});
}
- clearTimeout(timer);
+ if (timer !== null) {
+ clearTimeout(timer);
+ }
resolve();
})();
});