mor
This commit is contained in:
parent
ff1f474324
commit
e151208e15
1 changed files with 2933 additions and 784 deletions
|
|
@ -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 = () => {};
|
||||
|
|
|
|||
Loading…
Reference in a new issue