@@ -20,6 +20,25 @@ jest.mock('../../../../../selectors/featureFlagController/homepage', () => ({
2020jest . mock ( '../../../../../selectors/networkController' , ( ) => ( {
2121 ...jest . requireActual ( '../../../../../selectors/networkController' ) ,
2222 selectEvmChainId : jest . fn ( ( ) => '0x1' ) , // Ethereum mainnet (not a testnet)
23+ selectChainId : jest . fn ( ( ) => '0x1' ) , // BalanceEmptyState also needs this
24+ } ) ) ;
25+
26+ // Mock navigation hooks instead of the entire component
27+ jest . mock ( '@react-navigation/native' , ( ) => ( {
28+ ...jest . requireActual ( '@react-navigation/native' ) ,
29+ useNavigation : ( ) => ( {
30+ navigate : jest . fn ( ) ,
31+ goBack : jest . fn ( ) ,
32+ reset : jest . fn ( ) ,
33+ } ) ,
34+ } ) ) ;
35+
36+ // Mock metrics hook used by BalanceEmptyState - simplified since we don't need to test tracking
37+ jest . mock ( '../../../../../components/hooks/useMetrics' , ( ) => ( {
38+ useMetrics : ( ) => ( {
39+ trackEvent : jest . fn ( ) ,
40+ createEventBuilder : jest . fn ( ( ) => ( { record : jest . fn ( ) } ) ) ,
41+ } ) ,
2342} ) ) ;
2443
2544const testState = {
@@ -65,12 +84,24 @@ describe('AccountGroupBalance', () => {
6584 } ) ;
6685
6786 it ( 'renders empty state when account group balance is zero' , ( ) => {
68- const { selectAccountGroupBalanceForEmptyState } = jest . requireMock (
69- '../../../../../selectors/assets/balances' ,
87+ const {
88+ selectAccountGroupBalanceForEmptyState,
89+ selectBalanceBySelectedAccountGroup,
90+ } = jest . requireMock ( '../../../../../selectors/assets/balances' ) ;
91+
92+ // Mock the regular balance selector to return data (prevents skeleton loader)
93+ ( selectBalanceBySelectedAccountGroup as jest . Mock ) . mockImplementation (
94+ ( ) => ( {
95+ totalBalanceInUserCurrency : 100 , // Some non-zero amount for current network
96+ userCurrency : 'usd' ,
97+ } ) ,
7098 ) ;
99+
100+ // Mock the empty state selector to return zero balance across all mainnet networks
71101 ( selectAccountGroupBalanceForEmptyState as jest . Mock ) . mockImplementation (
72102 ( ) => ( {
73- totalBalanceInUserCurrency : 0 ,
103+ totalBalanceInUserCurrency : 0 , // Zero across all mainnet networks
104+ userCurrency : 'usd' ,
74105 } ) ,
75106 ) ;
76107
0 commit comments