This commit is contained in:
Andras Schmelczer 2026-09-26 20:22:19 +01:00
commit ca905ac1ce

View file

@ -55,8 +55,10 @@ test("offline content notifications need no saves and restart reads the current
const pending = internals.database.state.pending;
assert(pending?.type === "content");
assert.equal(pending.documentId, "a");
assert.equal(pending.request.content.type, "Snapshot");
assert(pending.request.content.type === "Snapshot");
assert.equal(
Buffer.from(pending.snapshot.contentBase64, "base64").toString(),
Buffer.from(pending.request.content.value, "base64").toString(),
"latest offline bytes"
);
} finally {
@ -144,6 +146,7 @@ test("remote binary replacement and deletion do not create backup artifacts", as
test("rejected content recovery remains idempotent across a rename and network failure", async () => {
let offline = true;
const f = await fixture(undefined, {
putFileContent: async () => ({ type: "StaleBase", ...head("a", 2, "remote") }),
getDocumentVersionContent: async () => {
if (offline) throw new Error("offline");
return bytes("base");
@ -157,15 +160,11 @@ test("rejected content recovery remains idempotent across a rename and network f
f.database.state.pending = {
type: "content",
documentId: "a",
snapshot,
hash: snapshot.hash,
request: {
requestId: "request",
parentVersionId: 1,
content: { type: "Snapshot", value: snapshot.contentBase64 }
},
response: {
type: "StaleBase",
...head("a", 2, "remote")
}
};
await f.database.save();