This commit is contained in:
Andras Schmelczer 2026-09-26 20:22:19 +01:00
commit ca905ac1ce
2 changed files with 181 additions and 202 deletions

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();

View file

@ -529,8 +529,8 @@ test("an ignored occupant arriving after the scan keeps its path and privacy", a
const { pending } = f.database.state;
assert(
pending?.type !== "content" ||
Buffer.from(pending.snapshot.contentBase64, "base64").toString() !==
"SECRET"
pending.request.content.type !== "Snapshot" ||
Buffer.from(pending.request.content.value, "base64").toString() !== "SECRET"
);
});
@ -820,11 +820,8 @@ for (const boundary of ["before:save", "durable:save"]) {
...database.state,
unconfirmed: [{
type: "fileManifest",
request: {
requestId: "rejected",
parentFileManifestId: 0,
entries: { retired: "old.md" }
},
requestId: "rejected",
entries: { retired: "old.md" },
rejection: "retired rejection"
}]
});