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>
40 lines
1.4 KiB
TypeScript
40 lines
1.4 KiB
TypeScript
import type { AssertableState } from "../utils/assertable-state";
|
|
import type { TestDefinition } from "../test-definition";
|
|
|
|
export const renameRoundtripTest: TestDefinition = {
|
|
description:
|
|
"Client 0 creates A.md, renames it to B.md, then renames it back to A.md. After each step both clients sync. Both should end with only A.md at the original path.",
|
|
clients: 2,
|
|
steps: [
|
|
{ type: "create", client: 0, path: "A.md", content: "original" },
|
|
{ type: "enable-sync", client: 0 },
|
|
{ type: "enable-sync", client: 1 },
|
|
{ type: "barrier" },
|
|
{
|
|
type: "assert-consistent",
|
|
verify: (s: AssertableState): void => {
|
|
s.assertContent("A.md", "original");
|
|
}
|
|
},
|
|
|
|
{ type: "rename", client: 0, oldPath: "A.md", newPath: "B.md" },
|
|
{ type: "barrier" },
|
|
|
|
{
|
|
type: "assert-consistent",
|
|
verify: (s: AssertableState): void => {
|
|
s.assertFileNotExists("A.md").assertContent("B.md", "original");
|
|
}
|
|
},
|
|
|
|
{ type: "rename", client: 0, oldPath: "B.md", newPath: "A.md" },
|
|
{ type: "barrier" },
|
|
|
|
{
|
|
type: "assert-consistent",
|
|
verify: (s: AssertableState): void => {
|
|
s.assertFileNotExists("B.md").assertContent("A.md", "original");
|
|
}
|
|
}
|
|
]
|
|
};
|