fix(settings): защищать восстановление базы от повторов и смены контекста
This commit is contained in:
1 parent
92b65a30ce
commit
57293479d1
13 files changed
+148
-188
No files matched your search
@@ -38,3 +38,12 @@ test("backup warning header is strict and malformed metadata preserves valid arc
|
||||
}
|
||||
}finally{globalThis.fetch=original}
|
||||
})
|
||||
|
||||
test("restore dispatch checkpoint runs only after local validation and immediately before POST",async()=>{
|
||||
const original=globalThis.fetch;const calls:string[]=[];try{
|
||||
globalThis.fetch=async()=>{calls.push("POST");return Response.json({ok:true})}
|
||||
const options={onDispatch:()=>calls.push("checkpoint")}
|
||||
await assert.rejects(restoreSystemDatabaseBackup("https://backend.test",new File(["wrong"],"wrong.dump"),options));assert.deepEqual(calls,[])
|
||||
await restoreSystemDatabaseBackup("https://backend.test",dump,options);assert.deepEqual(calls,["checkpoint","POST"])
|
||||
}finally{globalThis.fetch=original}
|
||||
})
|
||||
Reference in new issue
Block a user