From becd7c222e754ad8304ab660920e92212d953ca9 Mon Sep 17 00:00:00 2001 From: Andras Schmelczer Date: Mon, 24 Feb 2025 22:47:09 +0000 Subject: [PATCH] Improve agent action logic with forbidden renames --- frontend/test-client/src/agent/mock-agent.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/frontend/test-client/src/agent/mock-agent.ts b/frontend/test-client/src/agent/mock-agent.ts index a933b98..53bc030 100644 --- a/frontend/test-client/src/agent/mock-agent.ts +++ b/frontend/test-client/src/agent/mock-agent.ts @@ -47,6 +47,15 @@ export class MockAgent extends MockClient { this.client.logger.info("Agent initialized"); } + public async delete(path: RelativePath): Promise { + assert( + this.doDeletes, + `Agent ${this.name} tried to delete file ${path} while doDeletes is false` + ); + + await super.delete(path); + } + public async act(): Promise { const options: (() => Promise)[] = [ this.createFileAction.bind(this), @@ -242,7 +251,7 @@ export class MockAgent extends MockClient { this.client.logger.info(`Decided to rename file ${file} to ${newName}`); if (!this.client.settings.getSettings().isSyncEnabled) { - this.doNotTouch.push(newName); + this.doNotTouch.push(file, newName); } return this.rename(file, newName);