Fix correctness issues

This commit is contained in:
Andras Schmelczer 2025-02-25 22:18:47 +00:00
parent 91af4dc143
commit d0302a72c3
No known key found for this signature in database
GPG key ID: FC8F2C3D3D1A718C
4 changed files with 62 additions and 37 deletions

View file

@ -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;
}