@@ -6,6 +6,7 @@ import { vi, describe, it, expect, beforeEach } from 'vitest';
66import { Mock } from 'vitest' ;
77import { QueryClient , QueryClientProvider } from '@tanstack/react-query' ;
88import { useWindowSize } from '@/components/history-table/utils' ;
9+ import { useSupportedChains } from '@/hooks/useSupportedChains' ;
910
1011// Mock ContractManager
1112vi . mock ( '@/services/ContractManager' , ( ) => ( {
@@ -32,6 +33,13 @@ vi.mock('@/hooks/useTransactions', () => ({
3233 useTransactions : vi . fn ( ) ,
3334} ) ) ;
3435
36+ // Mock useSupportedChains
37+ vi . mock ( '@/hooks/useSupportedChains' , ( ) => ( {
38+ useSupportedChains : vi . fn ( ( ) => ( {
39+ isSupported : true ,
40+ } ) ) ,
41+ } ) ) ;
42+
3543// Mock window size hook and utils
3644vi . mock ( '@/components/history-table/utils' , ( ) => ( {
3745 useWindowSize : vi . fn ( ) ,
@@ -78,6 +86,19 @@ describe('TransactionsTable', () => {
7886 beforeEach ( ( ) => {
7987 vi . clearAllMocks ( ) ;
8088 ( useWindowSize as Mock ) . mockReturnValue ( { width : 1024 } ) ; // Default to desktop
89+ ( useSupportedChains as Mock ) . mockReturnValue ( { isSupported : true } ) ; // Default to supported chain
90+ } ) ;
91+
92+ it ( 'returns null when chain is not supported' , async ( ) => {
93+ ( useSupportedChains as Mock ) . mockReturnValue ( { isSupported : false } ) ;
94+ ( useAccount as Mock ) . mockReturnValue ( { address : '0x123' } as UseAccountReturn ) ;
95+ ( useTransactions as Mock ) . mockReturnValue ( {
96+ data : [ ] ,
97+ isLoading : false
98+ } as UseTransactionsReturn ) ;
99+
100+ const { container } = render ( < TransactionsTable /> , { wrapper } ) ;
101+ expect ( container . firstChild ) . toBeNull ( ) ;
81102 } ) ;
82103
83104 it ( 'shows wallet not connected state when no wallet is connected' , async ( ) => {
0 commit comments