This commit is contained in:
Andras Schmelczer 2025-03-22 20:50:43 +00:00
parent 62427183fd
commit a8cadd1e53
No known key found for this signature in database
GPG key ID: FC8F2C3D3D1A718C
4 changed files with 27 additions and 24 deletions

View file

@ -1,3 +1,4 @@
import type { StoredDatabase } from "sync-client/dist/types/persistence/database";
import { assert } from "../utils/assert";
import {
type RelativePath,
@ -9,7 +10,17 @@ import {
export class MockClient implements FileSystemOperations {
protected readonly localFiles = new Map<string, Uint8Array>();
protected client!: SyncClient;
protected data: object | undefined = undefined;
protected data: Partial<{
settings: Partial<SyncSettings>;
database: Partial<StoredDatabase>;
}> = {
database: {
// Assume all clients start at the same time so there's no need to fetch
// any shared state.
hasInitialSyncCompleted: true
}
};
public constructor(
private readonly initialSettings: Partial<SyncSettings>,
@ -37,6 +48,8 @@ export class MockClient implements FileSystemOperations {
);
})
);
await this.client.start();
}
public async listAllFiles(): Promise<RelativePath[]> {