@@ -98,6 +98,7 @@ jest.mock('../../../selectors/networkController', () => ({
9898 selectNetworkConfigurations : jest . fn ( ) ,
9999 selectProviderType : jest . fn ( ) ,
100100 selectRpcUrl : jest . fn ( ) ,
101+ selectProviderConfig : jest . fn ( ) ,
101102} ) ) ;
102103jest . mock ( '../../../selectors/networkEnablementController' , ( ) => ( {
103104 selectEVMEnabledNetworks : jest . fn ( ) ,
@@ -145,6 +146,16 @@ jest.mock('../../UI/Bridge/hooks/useBridgeHistoryItemBySrcTxHash', () => ({
145146 } ) ,
146147} ) ) ;
147148
149+ const mockGetBlockExplorerUrl = jest . fn ( ( ) => undefined ) ;
150+ const mockGetBlockExplorerName = jest . fn ( ( ) => 'Explorer' ) ;
151+ jest . mock ( '../../hooks/useBlockExplorer' , ( ) => ( {
152+ __esModule : true ,
153+ default : ( ) => ( {
154+ getBlockExplorerUrl : mockGetBlockExplorerUrl ,
155+ getBlockExplorerName : mockGetBlockExplorerName ,
156+ } ) ,
157+ } ) ) ;
158+
148159const mockTransactionsFooter = jest . fn ( ( props : unknown ) => {
149160 const ReactActual = jest . requireActual ( 'react' ) ;
150161 const { Text } = jest . requireActual ( 'react-native' ) ;
@@ -183,6 +194,7 @@ jest.mock('../../../core/Multichain/utils', () => ({
183194 __esModule : true ,
184195 getAddressUrl : ( address : string , chainId : string ) =>
185196 mockGetAddressUrl ( address , chainId ) ,
197+ isNonEvmChainId : jest . fn ( ( chainId : string ) => chainId . includes ( ':' ) ) ,
186198} ) ) ;
187199
188200// Mock refresh util
@@ -292,6 +304,7 @@ const {
292304 selectNetworkConfigurations,
293305 selectProviderType,
294306 selectRpcUrl,
307+ selectProviderConfig,
295308} = jest . requireMock ( '../../../selectors/networkController' ) ;
296309const { selectEVMEnabledNetworks, selectNonEVMEnabledNetworks } =
297310 jest . requireMock ( '../../../selectors/networkEnablementController' ) ;
@@ -312,6 +325,10 @@ describe('UnifiedTransactionsView', () => {
312325 mockTransactionsFooter . mockClear ( ) ;
313326 mockMultichainTransactionsFooter . mockClear ( ) ;
314327 mockGetAddressUrl . mockClear ( ) ;
328+ mockGetBlockExplorerUrl . mockClear ( ) ;
329+ mockGetBlockExplorerUrl . mockReturnValue ( undefined ) ;
330+ mockGetBlockExplorerName . mockClear ( ) ;
331+ mockGetBlockExplorerName . mockReturnValue ( 'Explorer' ) ;
315332 mockGetAddressUrl . mockImplementation (
316333 ( address ?: string ) => `https://solscan.io/account/${ address } ` ,
317334 ) ;
@@ -350,6 +367,8 @@ describe('UnifiedTransactionsView', () => {
350367 if ( selector === selectNetworkConfigurations ) return { } ;
351368 if ( selector === selectProviderType ) return 'rpc' ;
352369 if ( selector === selectRpcUrl ) return 'https://rpc.example' ;
370+ if ( selector === selectProviderConfig )
371+ return { type : 'rpc' , rpcUrl : 'https://rpc.example' } ;
353372 if ( selector === selectEVMEnabledNetworks ) return [ '0x1' ] ;
354373 if ( selector === selectNonEVMEnabledNetworks ) return [ 'solana:mainnet' ] ;
355374 if ( selector === selectCurrentCurrency ) return 'USD' ;
@@ -410,8 +429,10 @@ describe('UnifiedTransactionsView', () => {
410429
411430 it ( 'pull-to-refresh calls updateIncomingTransactions' , async ( ) => {
412431 const { UNSAFE_getAllByType } = render ( < UnifiedTransactionsView /> ) ;
432+
413433 const [ rc ] = UNSAFE_getAllByType ( RefreshControl ) ;
414- rc . props . onRefresh ( ) ;
434+ await rc . props . onRefresh ( ) ;
435+
415436 expect ( updateIncomingTransactions ) . toHaveBeenCalled ( ) ;
416437 } ) ;
417438
@@ -583,6 +604,8 @@ describe('UnifiedTransactionsView', () => {
583604 if ( selector === selectNetworkConfigurations ) return { } ;
584605 if ( selector === selectProviderType ) return 'rpc' ;
585606 if ( selector === selectRpcUrl ) return 'https://rpc.example' ;
607+ if ( selector === selectProviderConfig )
608+ return { type : 'rpc' , rpcUrl : 'https://rpc.example' } ;
586609 if ( selector === selectEVMEnabledNetworks ) return [ '0x1' , '0x5' ] ;
587610 if ( selector === selectNonEVMEnabledNetworks ) return [ ] ;
588611 if ( selector === selectCurrentCurrency ) return 'USD' ;
@@ -599,12 +622,9 @@ describe('UnifiedTransactionsView', () => {
599622 expect ( footerProps . rpcBlockExplorer ) . toBeUndefined ( ) ;
600623
601624 footerProps . onViewBlockExplorer ?.( ) ;
602- expect ( networksMock . getBlockExplorerAddressUrl ) . toHaveBeenCalledWith (
603- 'rpc' ,
604- '0xabc' ,
605- undefined ,
606- ) ;
607- expect ( networksMock . getBlockExplorerAddressUrl ) . toHaveBeenCalledTimes ( 1 ) ;
625+ // When configBlockExplorerUrl is undefined (multiple chains case),
626+ // the component uses blockExplorerUrl directly without calling getBlockExplorerAddressUrl
627+ expect ( networksMock . getBlockExplorerAddressUrl ) . not . toHaveBeenCalled ( ) ;
608628 isRemoveGlobalNetworkSelectorEnabled . mockReturnValue ( false ) ;
609629 } ) ;
610630 } ) ;
@@ -635,6 +655,8 @@ describe('UnifiedTransactionsView', () => {
635655 if ( selector === selectNetworkConfigurations ) return { } ;
636656 if ( selector === selectProviderType ) return 'rpc' ;
637657 if ( selector === selectRpcUrl ) return 'https://rpc.example' ;
658+ if ( selector === selectProviderConfig )
659+ return { type : 'rpc' , rpcUrl : 'https://rpc.example' } ;
638660 if ( selector === selectEVMEnabledNetworks ) return [ ] ;
639661 if ( selector === selectNonEVMEnabledNetworks ) return [ 'solana:mainnet' ] ;
640662 if ( selector === selectCurrentCurrency ) return 'USD' ;
@@ -682,6 +704,8 @@ describe('UnifiedTransactionsView', () => {
682704 if ( selector === selectNetworkConfigurations ) return { } ;
683705 if ( selector === selectProviderType ) return 'rpc' ;
684706 if ( selector === selectRpcUrl ) return 'https://rpc.example' ;
707+ if ( selector === selectProviderConfig )
708+ return { type : 'rpc' , rpcUrl : 'https://rpc.example' } ;
685709 if ( selector === selectEVMEnabledNetworks ) return [ ] ;
686710 if ( selector === selectNonEVMEnabledNetworks )
687711 return [ 'bip122:000000000019d6689c085ae165831e93' ] ;
@@ -720,6 +744,8 @@ describe('UnifiedTransactionsView', () => {
720744 if ( selector === selectTokens ) return [ ] ;
721745 if ( selector === selectChainId ) return '0x1' ;
722746 if ( selector === selectIsPopularNetwork ) return false ;
747+ if ( selector === selectProviderConfig )
748+ return { type : 'rpc' , rpcUrl : 'https://rpc.example' } ;
723749 if ( selector === selectEVMEnabledNetworks ) return [ ] ;
724750 if ( selector === selectNonEVMEnabledNetworks ) return [ ] ;
725751 if ( selector === selectCurrentCurrency ) return 'USD' ;
@@ -754,6 +780,8 @@ describe('UnifiedTransactionsView', () => {
754780 if ( selector === selectTokens ) return [ ] ;
755781 if ( selector === selectChainId ) return '0x1' ;
756782 if ( selector === selectIsPopularNetwork ) return false ;
783+ if ( selector === selectProviderConfig )
784+ return { type : 'rpc' , rpcUrl : 'https://rpc.example' } ;
757785 if ( selector === selectEVMEnabledNetworks ) return [ ] ;
758786 if ( selector === selectNonEVMEnabledNetworks ) return [ ] ;
759787 if ( selector === selectCurrentCurrency ) return 'USD' ;
0 commit comments