diff --git a/components/bank/components/__tests__/historyBox.test.tsx b/components/bank/components/__tests__/historyBox.test.tsx index 0bbbd209..32683f2d 100644 --- a/components/bank/components/__tests__/historyBox.test.tsx +++ b/components/bank/components/__tests__/historyBox.test.tsx @@ -20,7 +20,7 @@ mock.module('@/hooks', () => ({ ], }, }), - useSendTxIncludingAddressQuery: () => ({ + useGetFilteredTxAndSuccessfulProposals: () => ({ sendTxs: mockTransactions, totalPages: 1, isLoading: false, @@ -31,19 +31,16 @@ mock.module('@/hooks', () => ({ describe('HistoryBox', () => { afterEach(() => { cleanup(); + mock.restore(); }); test('renders correctly', () => { - renderWithChainProvider( - - ); + renderWithChainProvider(); expect(screen.getByText('Transaction History')).toBeTruthy(); }); test('displays transactions', () => { - renderWithChainProvider( - - ); + renderWithChainProvider(); const sentText = screen.getByText('Sent'); const receivedText = screen.getByText('Received'); @@ -53,9 +50,7 @@ describe('HistoryBox', () => { }); test('opens modal when clicking on a transaction', () => { - renderWithChainProvider( - - ); + renderWithChainProvider(); const transactionElement = screen.getByText('Sent').closest('div[role="button"]'); @@ -66,9 +61,7 @@ describe('HistoryBox', () => { }); test('formats amount correctly', () => { - renderWithChainProvider( - - ); + renderWithChainProvider(); const sentAmount = screen.queryByText('-1 TOKEN'); const receivedAmount = screen.queryByText('+2 TOKEN'); @@ -78,9 +71,7 @@ describe('HistoryBox', () => { }); test('displays both sent and received transactions', () => { - renderWithChainProvider( - - ); + renderWithChainProvider(); const sentText = screen.getByText('Sent'); const receivedText = screen.getByText('Received'); diff --git a/components/bank/components/historyBox.tsx b/components/bank/components/historyBox.tsx index d6175582..42f0dae7 100644 --- a/components/bank/components/historyBox.tsx +++ b/components/bank/components/historyBox.tsx @@ -48,11 +48,9 @@ function formatLargeNumber(num: number): string { export function HistoryBox({ isLoading: initialLoading, - send, address, }: { isLoading: boolean; - send: TransactionGroup[]; address: string; }) { const [selectedTx, setSelectedTx] = useState(null); diff --git a/tests/mock.ts b/tests/mock.ts index 1272a936..509d54cc 100644 --- a/tests/mock.ts +++ b/tests/mock.ts @@ -5,7 +5,7 @@ import { } from '@liftedinit/manifestjs/dist/codegen/cosmos/staking/v1beta1/staking'; import { ExtendedValidatorSDKType, TransactionGroup } from '@/components'; import { CombinedBalanceInfo } from '@/utils/types'; -import { ExtendedGroupType } from '@/hooks'; +import { ExtendedGroupType, HistoryTxType } from '@/hooks'; import { MemberSDKType, ProposalExecutorResult, @@ -200,6 +200,7 @@ export const mockTransactions: TransactionGroup[] = [ block_number: 1, formatted_date: '2023-05-01T12:00:00Z', data: { + tx_type: HistoryTxType.SEND, from_address: 'address1', to_address: 'address2', amount: [{ amount: '1000000', denom: 'utoken' }], @@ -210,6 +211,7 @@ export const mockTransactions: TransactionGroup[] = [ block_number: 2, formatted_date: '2023-05-02T12:00:00Z', data: { + tx_type: HistoryTxType.SEND, from_address: 'address2', to_address: 'address1', amount: [{ amount: '2000000', denom: 'utoken' }],