This commit is contained in:
Andras Schmelczer 2026-09-27 13:58:54 +01:00
commit e151208e15

View file

@ -4,6 +4,7 @@ import { fixture, bytes, randomUUID } from "./sync-server-fixture";
import { assertCanonical } from "./canonical";
import { SyncClient } from "../sync-client/src/sync-client";
import { MemoryDisk, MemoryPersistence } from "./storage";
import { ContentLedger } from "./oracles";
for (const powerLoss of [false, true])
for (const operation of ["create", "replace", "move", "metadata"] as const)
@ -98,6 +99,9 @@ for (const powerLoss of [false, true])
files: () => f.disk.userFiles(),
database: () => f.store.snapshot().database
};
const edits = new ContentLedger();
edits.add("USER EDIT");
edits.add("AFTER INTERRUPTION");
const peerDisk = new MemoryDisk();
const peerStore = new MemoryPersistence({
settings: f.store.snapshot().settings
@ -119,6 +123,8 @@ for (const powerLoss of [false, true])
f.url,
"test-token-change-me"
);
for (const client of clients)
edits.assertPreserved(client.files());
assert.deepEqual(
f.disk.userFiles().get("after.md"),
bytes("AFTER INTERRUPTION\n")
@ -141,6 +147,8 @@ for (const powerLoss of [false, true])
files,
"A second restart must not replay old writes"
);
for (const client of clients)
edits.assertPreserved(client.files());
} finally {
f.disk.boundary = () => {};
f.store.boundary = () => {};