Fix correctness issues
This commit is contained in:
parent
91af4dc143
commit
d0302a72c3
4 changed files with 62 additions and 37 deletions
|
|
@ -33,6 +33,7 @@ export class MockAgent extends MockClient {
|
|||
console.error(formatted);
|
||||
// Let's not ignore errors
|
||||
process.exit(1);
|
||||
break;
|
||||
case LogLevel.WARNING:
|
||||
console.warn(formatted);
|
||||
break;
|
||||
|
|
@ -48,15 +49,6 @@ export class MockAgent extends MockClient {
|
|||
this.client.logger.info("Agent initialized");
|
||||
}
|
||||
|
||||
public async delete(path: RelativePath): Promise<void> {
|
||||
assert(
|
||||
this.doDeletes,
|
||||
`Agent ${this.name} tried to delete file ${path} while doDeletes is false`
|
||||
);
|
||||
|
||||
await super.delete(path);
|
||||
}
|
||||
|
||||
public async act(): Promise<void> {
|
||||
const options: (() => Promise<unknown>)[] = [
|
||||
this.createFileAction.bind(this),
|
||||
|
|
@ -97,8 +89,8 @@ export class MockAgent extends MockClient {
|
|||
}
|
||||
|
||||
public async finish(): Promise<void> {
|
||||
await Promise.all(this.pendingActions);
|
||||
await this.client.settings.setSetting("isSyncEnabled", true);
|
||||
await Promise.all(this.pendingActions);
|
||||
this.client.stop();
|
||||
await this.client.syncer.waitForSyncQueue();
|
||||
await this.client.syncer.applyRemoteChangesLocally();
|
||||
|
|
@ -196,7 +188,7 @@ export class MockAgent extends MockClient {
|
|||
private async createFileAction(): Promise<void> {
|
||||
const file = this.getFileName();
|
||||
|
||||
if (await this.exists(file)) {
|
||||
if (this.doNotTouch.includes(file) || (await this.exists(file))) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -246,7 +238,7 @@ export class MockAgent extends MockClient {
|
|||
|
||||
const newName = this.getFileName();
|
||||
|
||||
if (await this.exists(newName)) {
|
||||
if (this.doNotTouch.includes(newName) || (await this.exists(newName))) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue