vault-link/frontend/deterministic-tests/src/tests/server-pause-both-edit-same-file.test.ts
Andras Schmelczer 0e3132f96c
Some checks are pending
Check / build (push) Waiting to run
E2E tests / build (push) Waiting to run
Publish CLI / publish-docker (push) Waiting to run
Publish server Docker image / publish-docker (push) Waiting to run
Add deterministic-tests (#190)
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>
2026-05-09 10:15:21 +01:00

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"
);
}
}
]
};