Nouveautés dans l'app, et « Tout effacer » synchronisé : cet appareil ou partout (2d)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
0ea0ea109f
commit
8ebdca0c30
@@ -104,3 +104,26 @@ test("erreurs : réseau absent, clé d'accès refusée ; un seul sync() à la fo
|
||||
await a;
|
||||
assert.equal(calls, 2, "une lecture, un envoi");
|
||||
});
|
||||
|
||||
test("« Tout effacer partout » : l'autre appareil reçoit « erased », et oublier permet de tout relire", async () => {
|
||||
const s = await startServer();
|
||||
try {
|
||||
const syncKey = generateSyncKey();
|
||||
const pc = memoryStore();
|
||||
const phone = memoryStore();
|
||||
await pc.add([weight("pc", "2026-11-01", 80)]);
|
||||
const syncPc = createSync({ store: pc, syncKey, baseUrl: s.base });
|
||||
const syncPhone = createSync({ store: phone, syncKey, baseUrl: s.base });
|
||||
await syncPc.sync();
|
||||
await syncPhone.sync();
|
||||
await syncPc.erase();
|
||||
await assert.rejects(syncPhone.sync(), (e) => e instanceof SyncError && e.code === "erased");
|
||||
// Oublier : une clé réactivée relirait tout depuis le début.
|
||||
const { journalId } = await deriveKeys(syncKey);
|
||||
assert.ok(phone.meta.get("sync:" + journalId));
|
||||
await syncPhone.forget();
|
||||
assert.equal(phone.meta.get("sync:" + journalId), null);
|
||||
} finally {
|
||||
await s.close();
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user