@@ -25,7 +25,7 @@ it('has disabled DEBUG_COMMANDS flag', () => {
2525} ) ;
2626
2727describe ( 'CLI' , ( ) => {
28- jest . setTimeout ( 45_000 ) ;
28+ jest . setTimeout ( 300_000 ) ;
2929
3030 let provider : ethers . providers . StaticJsonRpcProvider ;
3131 let deployer : ethers . providers . JsonRpcSigner ;
@@ -333,7 +333,6 @@ Template data:
333333 describe ( 'withdrawal' , ( ) => {
334334 let sponsor : ethers . Wallet ;
335335 let sponsorWallet : ethers . Wallet ;
336- const sponsorBalance = ( ) => sponsor . getBalance ( ) ;
337336
338337 beforeEach ( async ( ) => {
339338 // Prepare for derivation of designated wallet - see test for designated wallet derivation for details
@@ -371,13 +370,25 @@ Template data:
371370
372371 expect ( checkWithdrawalStatus ( ) ) . toBe ( 'Withdrawal request is not fulfilled yet' ) ;
373372
374- const balanceBefore = await sponsorBalance ( ) ;
373+ const balanceBefore = await sponsor . getBalance ( ) ;
375374 airnodeRrp = airnodeRrp . connect ( sponsorWallet ) ;
376- await admin . fulfillWithdrawal ( airnodeRrp , withdrawalRequestId , airnodeWallet . address , sponsor . address , '0.8' ) ;
377- expect ( checkWithdrawalStatus ( ) ) . toBe ( 'Withdrawn amount: 800000000000000000' ) ;
378- expect ( ( await sponsorBalance ( ) ) . toString ( ) ) . toBe (
379- balanceBefore . add ( ethers . BigNumber . from ( '800000000000000000' ) ) . toString ( )
375+
376+ const fulfillResult = await admin . fulfillWithdrawal (
377+ airnodeRrp ,
378+ withdrawalRequestId ,
379+ airnodeWallet . address ,
380+ sponsor . address ,
381+ '0.8'
380382 ) ;
383+ expect ( fulfillResult ) . not . toBeNull ( ) ;
384+
385+ expect ( checkWithdrawalStatus ( ) ) . toBe ( 'Withdrawn amount: 800000000000000000' ) ;
386+
387+ // Create a fresh provider instance to avoid stale connection issues in CI
388+ const freshProvider = new ethers . providers . StaticJsonRpcProvider ( PROVIDER_URL ) ;
389+ const balanceAfter = await freshProvider . getBalance ( sponsor . address ) ;
390+
391+ expect ( balanceAfter . toString ( ) ) . toBe ( balanceBefore . add ( ethers . BigNumber . from ( '800000000000000000' ) ) . toString ( ) ) ;
381392 } ) ;
382393 } ) ;
383394
0 commit comments