Fix inifinite loop at end of test
This commit is contained in:
parent
a7b518d7ea
commit
a5bcaec9fe
2 changed files with 5 additions and 3 deletions
|
|
@ -141,6 +141,7 @@ export class SyncClient {
|
||||||
/// and the local database but retain the settings.
|
/// and the local database but retain the settings.
|
||||||
/// The SyncClient can be used again after calling this method.
|
/// The SyncClient can be used again after calling this method.
|
||||||
public async reset(): Promise<void> {
|
public async reset(): Promise<void> {
|
||||||
|
this.stop();
|
||||||
await this._syncer.reset();
|
await this._syncer.reset();
|
||||||
this._history.reset();
|
this._history.reset();
|
||||||
await this._database.resetSyncState();
|
await this._database.resetSyncState();
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,8 @@ export class MockAgent extends MockClient {
|
||||||
switch (message.level) {
|
switch (message.level) {
|
||||||
case LogLevel.ERROR:
|
case LogLevel.ERROR:
|
||||||
console.error(formatted);
|
console.error(formatted);
|
||||||
break;
|
// Let's not ignore errors
|
||||||
|
process.exit(1);
|
||||||
case LogLevel.WARNING:
|
case LogLevel.WARNING:
|
||||||
console.warn(formatted);
|
console.warn(formatted);
|
||||||
break;
|
break;
|
||||||
|
|
@ -98,9 +99,9 @@ export class MockAgent extends MockClient {
|
||||||
public async finish(): Promise<void> {
|
public async finish(): Promise<void> {
|
||||||
await Promise.all(this.pendingActions);
|
await Promise.all(this.pendingActions);
|
||||||
await this.client.settings.setSetting("isSyncEnabled", true);
|
await this.client.settings.setSetting("isSyncEnabled", true);
|
||||||
|
this.client.stop();
|
||||||
await this.client.syncer.waitForSyncQueue();
|
await this.client.syncer.waitForSyncQueue();
|
||||||
await this.client.syncer.applyRemoteChangesLocally();
|
await this.client.syncer.applyRemoteChangesLocally();
|
||||||
this.client.stop();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public assertFileSystemsAreConsistent(otherAgent: MockAgent): void {
|
public assertFileSystemsAreConsistent(otherAgent: MockAgent): void {
|
||||||
|
|
@ -216,7 +217,7 @@ export class MockAgent extends MockClient {
|
||||||
);
|
);
|
||||||
return this.client.settings.setSetting(
|
return this.client.settings.setSetting(
|
||||||
"fetchChangesUpdateIntervalMs",
|
"fetchChangesUpdateIntervalMs",
|
||||||
Math.random() * 1000
|
Math.random() * 2000 + 100
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue