@@ -144,11 +144,41 @@ describe('Bridge Resolver', () => {
144144 getBlockchainStatus : jest . fn ( ) . mockReturnValue ( {
145145 allowThirdPartyContracts : false ,
146146 } ) ,
147+ getBridgeSubsidy : jest . fn ( ( bridgeCallData : bigint ) => {
148+ const fullCallData = BridgeCallData . fromBigInt ( bridgeCallData ) ;
149+ return {
150+ criteria : 1n ,
151+ subsidyInGas : 10000 ,
152+ subsidyInWei : 25000000n ,
153+ bridgeAddressId : fullCallData . bridgeAddressId ,
154+ } ;
155+ } ) ,
147156 } as any ;
148157
149158 bridgeResolver = new BridgeResolver ( bridgeConfigs , blockchain as any ) ;
150159 } ) ;
151160
161+ it ( 'returns bridge subsidy from the data provider contract if contract not disabled' , async ( ) => {
162+ const localBridgeResolver = new BridgeResolver ( bridgeConfigs , blockchain as any ) ;
163+ const [ cd ] = generateSampleBridgeCallDatas ( ) ;
164+ const result = await localBridgeResolver . getBridgeSubsidy ( cd . callData ) ;
165+ expect ( blockchain . getBridgeSubsidy ) . toHaveBeenCalledTimes ( 1 ) ;
166+ expect ( result ) . toEqual ( {
167+ criteria : 1n ,
168+ subsidyInGas : 10000 ,
169+ subsidyInWei : 25000000n ,
170+ bridgeAddressId : BridgeCallData . fromBigInt ( cd . callData ) . bridgeAddressId ,
171+ } ) ;
172+ } ) ;
173+
174+ it ( 'returns undefined bridge subsidy if contract has been disabled' , async ( ) => {
175+ const localBridgeResolver = new BridgeResolver ( bridgeConfigs , blockchain as any , true ) ;
176+ const [ cd ] = generateSampleBridgeCallDatas ( ) ;
177+ const result = await localBridgeResolver . getBridgeSubsidy ( cd . callData ) ;
178+ expect ( blockchain . getBridgeSubsidy ) . toHaveBeenCalledTimes ( 0 ) ;
179+ expect ( result ) . toBeUndefined ( ) ;
180+ } ) ;
181+
152182 it ( 'returns correct bridge config' , ( ) => {
153183 const callDatas = generateSampleBridgeCallDatas ( ) ;
154184 for ( const cd of callDatas ) {
0 commit comments