Reviewed-on: https://home.schmelczer.dev/git/git/andras/vault-link/pulls/190 Co-authored-by: Andras Schmelczer <andras@schmelczer.dev> Co-committed-by: Andras Schmelczer <andras@schmelczer.dev>
68 lines
2 KiB
TypeScript
68 lines
2 KiB
TypeScript
import type { AssertableState } from "../utils/assertable-state";
|
|
import type { TestDefinition } from "../test-definition";
|
|
|
|
export const serverPauseBothEditSameFileTest: TestDefinition = {
|
|
description:
|
|
"Both clients edit different sections of the same file while the server is paused. After resuming and converging, client 0 makes another edit to verify further updates still work correctly.",
|
|
clients: 2,
|
|
steps: [
|
|
{
|
|
type: "create",
|
|
client: 0,
|
|
path: "shared.md",
|
|
content: "line 1: original\nline 2: original\nline 3: original"
|
|
},
|
|
{ type: "enable-sync", client: 0 },
|
|
{ type: "enable-sync", client: 1 },
|
|
{ type: "barrier" },
|
|
|
|
{ type: "pause-server" },
|
|
|
|
{
|
|
type: "update",
|
|
client: 0,
|
|
path: "shared.md",
|
|
content:
|
|
"line 1: edited by client 0\nline 2: original\nline 3: original"
|
|
},
|
|
{
|
|
type: "update",
|
|
client: 1,
|
|
path: "shared.md",
|
|
content:
|
|
"line 1: original\nline 2: original\nline 3: edited by client 1"
|
|
},
|
|
|
|
{ type: "resume-server" },
|
|
{ type: "barrier" },
|
|
|
|
{
|
|
type: "assert-consistent",
|
|
verify: (s: AssertableState): void => {
|
|
s.assertFileCount(1).assertContains(
|
|
"shared.md",
|
|
"edited by client 0",
|
|
"edited by client 1"
|
|
);
|
|
}
|
|
},
|
|
|
|
{
|
|
type: "update",
|
|
client: 0,
|
|
path: "shared.md",
|
|
content: "post-merge edit from client 0"
|
|
},
|
|
{ type: "barrier" },
|
|
|
|
{
|
|
type: "assert-consistent",
|
|
verify: (s: AssertableState): void => {
|
|
s.assertFileCount(1).assertContains(
|
|
"shared.md",
|
|
"post-merge edit from client 0"
|
|
);
|
|
}
|
|
}
|
|
]
|
|
};
|