Add resetting tests

This commit is contained in:
Andras Schmelczer 2025-11-23 21:55:57 +00:00
parent c3cbde052a
commit b1826907e7
2 changed files with 26 additions and 1 deletions

View file

@ -18,6 +18,7 @@ export class MockAgent extends MockClient {
initialSettings: Partial<SyncSettings>,
public readonly name: string,
private readonly doDeletes: boolean,
private readonly doResets: boolean,
useSlowFileEvents: boolean,
private readonly jitterScaleInSeconds: number
) {
@ -107,6 +108,10 @@ export class MockAgent extends MockClient {
}
}
if (Math.random() < 0.1 && this.doResets) {
options.push(this.resetClient.bind(this));
}
this.pendingActions.push(
(async (): Promise<unknown> => {
try {
@ -229,6 +234,12 @@ export class MockAgent extends MockClient {
}
}
private async resetClient(): Promise<void> {
this.client.logger.info(`Resetting client ${this.name}`);
await this.client.destroy();
await this.init();
}
private async createFileAction(): Promise<void> {
const file = this.getFileName();