.
This commit is contained in:
parent
25f64ec690
commit
ff1f474324
1 changed files with 3271 additions and 2003 deletions
|
|
@ -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(
|
||||
|
|
|
|||
Loading…
Reference in a new issue