Scripted multi-client harness against a real server (~110 scenario tests, server-control, managed-websocket, test-runner). Wires the new package into frontend/package.json workspaces and the lint script. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
44 lines
1.6 KiB
TypeScript
44 lines
1.6 KiB
TypeScript
import type { AssertableState } from "../utils/assertable-state";
|
|
import type { TestDefinition } from "../test-definition";
|
|
|
|
export const renameSwapTest: TestDefinition = {
|
|
description:
|
|
"Client 0 has A.md and B.md synced. Goes offline and swaps them using " +
|
|
"a temp file: A.md -> temp.md, B.md -> A.md, temp.md -> B.md. " +
|
|
"When Client 0 reconnects, both contents should exist across two files.",
|
|
clients: 2,
|
|
steps: [
|
|
{ type: "create", client: 0, path: "A.md", content: "content-a" },
|
|
{ type: "create", client: 0, path: "B.md", content: "content-b" },
|
|
{ type: "enable-sync", client: 0 },
|
|
{ type: "enable-sync", client: 1 },
|
|
{ type: "barrier" },
|
|
{
|
|
type: "assert-consistent",
|
|
verify: (s: AssertableState): void => {
|
|
s.assertContent("A.md", "content-a").assertContent(
|
|
"B.md",
|
|
"content-b"
|
|
);
|
|
}
|
|
},
|
|
|
|
{ type: "disable-sync", client: 0 },
|
|
{ type: "rename", client: 0, oldPath: "A.md", newPath: "temp.md" },
|
|
{ type: "rename", client: 0, oldPath: "B.md", newPath: "A.md" },
|
|
{ type: "rename", client: 0, oldPath: "temp.md", newPath: "B.md" },
|
|
|
|
{ type: "enable-sync", client: 0 },
|
|
{ type: "barrier" },
|
|
|
|
{
|
|
type: "assert-consistent",
|
|
verify: (s: AssertableState): void => {
|
|
s.assertFileNotExists("temp.md")
|
|
.assertFileCount(2)
|
|
.assertAnyFileContains("content-b")
|
|
.assertAnyFileContains("content-a");
|
|
}
|
|
}
|
|
]
|
|
};
|