Refactor tests

This commit is contained in:
Andras Schmelczer 2026-01-18 13:46:59 +00:00
parent 16afe31e89
commit f53ac121e8
19 changed files with 352 additions and 570 deletions

View file

@ -1,24 +1,22 @@
/**
* Deterministic test framework for VaultLink sync testing.
* Allows defining exact sequences of operations to test specific scenarios.
*/
export interface ClientState {
files: Map<string, string>;
}
export type TestStep =
| { type: "create"; client: number; path: string; content: string }
| { type: "update"; client: number; path: string; content: string }
| { type: "rename"; client: number; oldPath: string; newPath: string }
| { type: "delete"; client: number; path: string }
| { type: "sync"; client?: number } // wait for sync (specific client or all if undefined)
| { type: "sync"; client?: number }
| { type: "disable-sync"; client: number }
| { type: "enable-sync"; client: number }
| { type: "wait"; duration: number } // wait N milliseconds
| { type: "pause-server" }
| { type: "resume-server" }
| { type: "barrier" } // wait for all clients to finish pending operations
| { type: "barrier" }
| { type: "assert-content"; client: number; path: string; content: string }
| { type: "assert-exists"; client: number; path: string }
| { type: "assert-not-exists"; client: number; path: string }
| { type: "assert-consistent" }; // all clients have same files and content
| { type: "assert-consistent"; verify?: (state: ClientState) => void };
export interface TestDefinition {
name: string;