This commit is contained in:
Andras Schmelczer 2026-09-27 11:09:36 +01:00
commit ff1f474324

View file

@ -3,7 +3,7 @@ import { test } from "node:test";
import { MemoryDisk, MemoryPersistence } from "./storage";
import {
Database,
emptyState,
createEmptyDatabase,
type StoredDatabase
} from "../sync-client/src/persistence/database";
import { FileOperations } from "../sync-client/src/file-operations/file-operations";
@ -28,7 +28,7 @@ async function fixture(
}
) {
const disk = new MemoryDisk();
const initial = emptyState("recovery-test");
const initial = createEmptyDatabase("recovery-test");
for (const [id, { path, text }] of Object.entries(contents)) {
await disk.userWrite(path, bytes(text));
initial.local[id] = path;
@ -211,7 +211,7 @@ for (const [name, create] of [
trace(label);
};
baseline.persistence.boundary = trace;
await baseline.restart().files.apply(baseline.next, baseline.writes);
await baseline.restart().files.applyChanges(baseline.next, baseline.writes);
assert.deepEqual(baseline.disk.userFiles(), baseline.expected);
assert.deepEqual(
baseline.persistence.snapshot().database!.local,
@ -242,7 +242,7 @@ for (const [name, create] of [
await assert.rejects(
current
.restart()
.files.apply(current.next, current.writes),
.files.applyChanges(current.next, current.writes),
/interrupted/
);
assert(fired);
@ -279,7 +279,7 @@ for (const [name, create] of [
assert.equal(
runtime.database.state.documents[id]
.observedHash,
(await runtime.files.snapshot(path))!.hash
(await runtime.files.readSnapshot(path))!.hash
);
}
assert(