1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-06-15 23:00:36 +02:00

Tests: Integration harness fixes and refactors. (#2569)

* Test harness fixes and integration test refactor and addition.

* Clean up.

* Address review comments.

* Improve method names.
This commit is contained in:
mic704b
2020-02-28 05:25:42 +11:00
committed by GitHub
parent a576ad2a39
commit 54dc2219fe
10 changed files with 221 additions and 173 deletions

View File

@ -37,9 +37,9 @@ class DecryptionWorker {
}
static instance() {
if (this.instance_) return this.instance_;
this.instance_ = new DecryptionWorker();
return this.instance_;
if (DecryptionWorker.instance_) return DecryptionWorker.instance_;
DecryptionWorker.instance_ = new DecryptionWorker();
return DecryptionWorker.instance_;
}
setEncryptionService(v) {
@ -250,8 +250,15 @@ class DecryptionWorker {
}
}
async cancelTimers() {
if (this.scheduleId_) clearTimeout(this.scheduleId_);
async destroy() {
this.eventEmitter_.removeAllListeners();
if (this.scheduleId_) {
clearTimeout(this.scheduleId_);
this.scheduleId_ = null;
}
this.eventEmitter_ = null;
DecryptionWorker.instance_ = null;
return new Promise((resolve) => {
const iid = setInterval(() => {
if (!this.startCalls_.length) {
@ -263,4 +270,6 @@ class DecryptionWorker {
}
}
DecryptionWorker.instance_ = null;
module.exports = DecryptionWorker;