fix: reject unconfirmed Telegram tests and invalid update responses

This commit is contained in:
2026-09-06 14:55:05 +03:00
parent 37fb7b0366
commit 120657758c
8 changed files with 57 additions and 6 deletions
+13
View File
@@ -36,3 +36,16 @@ test('late private account responses and explicit cancellation do not reach the
await assert.rejects(accountRequest('/state',{signal:controller.signal}),{name:'AbortError'});
} finally {globalThis.fetch=original;if(storage)Object.defineProperty(globalThis,'localStorage',storage);else delete globalThis.localStorage;}
});
test('Telegram test does not report success without a provider receipt or retry an ambiguous response',async()=>{
const {telegramTest}=await import('../src/services/account.js');
const original=globalThis.fetch;let calls=0;
try{
globalThis.fetch=async()=>{calls++;return Response.json({success:true});};
await assert.rejects(telegramTest(),/kabulü doğrulanamadı/);assert.equal(calls,1);
globalThis.fetch=async()=>Response.json({success:true,id:'123:42'});
assert.equal((await telegramTest()).id,'123:42');
globalThis.fetch=async()=>Response.json({success:false,error:'Telegram hizmeti etkin değil.'},{status:503});
await assert.rejects(telegramTest(),/etkin değil/);
}finally{globalThis.fetch=original;}
});