From f3339a617ee61ae3ce3bbefcbcea24049ddaa439 Mon Sep 17 00:00:00 2001 From: Paul Cramer Date: Tue, 16 Jul 2024 16:44:21 -0700 Subject: [PATCH] chore: Test Transaction component --- .../components/Transaction.test.tsx | 0 .../components/TransactionButton.test.tsx | 0 .../components/TransactionGasFee.test.tsx | 0 .../TransactionGasFeeEstimate.test.tsx | 0 .../TransactionGasFeeLabel.test.tsx | 0 .../TransactionGasFeeSponsoredBy.test.tsx | 0 .../components/TransactionProvider.test.tsx | 0 .../components/TransactionStatus.test.tsx | 0 .../TransactionStatusAction.test.tsx | 0 .../TransactionStatusLabel.test.tsx | 23 +++++++++++++++++++ 10 files changed, 23 insertions(+) create mode 100644 src/transaction/components/Transaction.test.tsx create mode 100644 src/transaction/components/TransactionButton.test.tsx create mode 100644 src/transaction/components/TransactionGasFee.test.tsx create mode 100644 src/transaction/components/TransactionGasFeeEstimate.test.tsx create mode 100644 src/transaction/components/TransactionGasFeeLabel.test.tsx create mode 100644 src/transaction/components/TransactionGasFeeSponsoredBy.test.tsx create mode 100644 src/transaction/components/TransactionProvider.test.tsx create mode 100644 src/transaction/components/TransactionStatus.test.tsx create mode 100644 src/transaction/components/TransactionStatusAction.test.tsx create mode 100644 src/transaction/components/TransactionStatusLabel.test.tsx diff --git a/src/transaction/components/Transaction.test.tsx b/src/transaction/components/Transaction.test.tsx new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/transaction/components/TransactionButton.test.tsx b/src/transaction/components/TransactionButton.test.tsx new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/transaction/components/TransactionGasFee.test.tsx b/src/transaction/components/TransactionGasFee.test.tsx new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/transaction/components/TransactionGasFeeEstimate.test.tsx b/src/transaction/components/TransactionGasFeeEstimate.test.tsx new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/transaction/components/TransactionGasFeeLabel.test.tsx b/src/transaction/components/TransactionGasFeeLabel.test.tsx new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/transaction/components/TransactionGasFeeSponsoredBy.test.tsx b/src/transaction/components/TransactionGasFeeSponsoredBy.test.tsx new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/transaction/components/TransactionProvider.test.tsx b/src/transaction/components/TransactionProvider.test.tsx new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/transaction/components/TransactionStatus.test.tsx b/src/transaction/components/TransactionStatus.test.tsx new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/transaction/components/TransactionStatusAction.test.tsx b/src/transaction/components/TransactionStatusAction.test.tsx new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/transaction/components/TransactionStatusLabel.test.tsx b/src/transaction/components/TransactionStatusLabel.test.tsx new file mode 100644 index 0000000000..7bce8d10d0 --- /dev/null +++ b/src/transaction/components/TransactionStatusLabel.test.tsx @@ -0,0 +1,23 @@ +import { render, screen } from '@testing-library/react'; +import { describe, it, expect, vi } from 'vitest'; +import { TransactionStatusLabel } from './TransactionStatusLabel'; +import { useGetTransactionStatus } from '../core/useGetTransactionStatus'; + +vi.mock('../core/useGetTransactionStatus', () => ({ + useGetTransactionStatus: vi.fn(), +})); + +describe('TransactionStatusLabel', () => { + it('renders transaction status label', () => { + (useGetTransactionStatus as vi.Mock).mockReturnValue({ + label: 'Successful!', + labelClassName: 'text-foreground-muted', + }); + + render(); + + const label = screen.getByText('Successful!'); + expect(label).toBeInTheDocument(); + expect(label).toHaveClass('text-foreground-muted'); + }); +});