fix: reject unconfirmed Telegram tests and invalid update responses
This commit is contained in:
@@ -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;}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user