diff options
author | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2020-02-23 11:44:24 -0500 |
---|---|---|
committer | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2020-02-23 11:44:24 -0500 |
commit | 0f9f2e446dd9c28fa67e4c73a2f573b4c57cfc04 (patch) | |
tree | d79e60a235eea47b467f8a0c838be0e6725c2b58 | |
parent | 897f2360be13db70ff2f533089ba8d38b0b744ed (diff) |
Clear timer variable
-rw-r--r-- | test/test-database.js | 7 |
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(); })(); }); |