Delete empty folders during syncing

This commit is contained in:
Andras Schmelczer 2025-10-19 16:10:41 +01:00
parent aa73a5d718
commit 116661c674
8 changed files with 64 additions and 20 deletions

View file

@ -94,7 +94,7 @@ export class MockAgent extends MockClient {
options.push(this.enableSyncAction.bind(this));
}
const files = await this.listAllFiles();
const files = await this.listFilesRecursively();
if (files.length > 0) {
options.push(

View file

@ -7,6 +7,7 @@ import {
SyncClient
} from "sync-client";
import type { TextWithCursors } from "reconcile-text";
export class MockClient implements FileSystemOperations {
protected readonly localFiles = new Map<string, Uint8Array>();
protected client!: SyncClient;
@ -46,7 +47,9 @@ export class MockClient implements FileSystemOperations {
await this.client.start();
}
public async listAllFiles(): Promise<RelativePath[]> {
public async listFilesRecursively(
_root: RelativePath | undefined = undefined // we don't use multi-level paths during tests
): Promise<RelativePath[]> {
return Array.from(this.localFiles.keys());
}