Skip to content

Commit

Permalink
Add transactionStatusAction
Browse files Browse the repository at this point in the history
  • Loading branch information
cpcramer committed Jul 16, 2024
1 parent f3339a6 commit afd2741
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
22 changes: 22 additions & 0 deletions src/transaction/components/TransactionStatusAction.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { render, screen } from '@testing-library/react';
import { describe, it, expect, vi } from 'vitest';
import { TransactionStatusAction } from './TransactionStatusAction';
import { useGetTransactionStatus } from '../core/useGetTransactionStatus';

vi.mock('../core/useGetTransactionStatus', () => ({
useGetTransactionStatus: vi.fn(),
}));

describe('TransactionStatusAction', () => {
it('renders transaction status action', () => {
(useGetTransactionStatus as vi.Mock).mockReturnValue({
actionElement: <button>Retry</button>,
});

render(<TransactionStatusAction className="custom-class" />);

const actionElement = screen.getByText('Retry');
expect(actionElement).toBeInTheDocument();
expect(actionElement.tagName).toBe('BUTTON');
});
});
2 changes: 1 addition & 1 deletion src/transaction/components/TransactionStatusLabel.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ describe('TransactionStatusLabel', () => {
expect(label).toBeInTheDocument();
expect(label).toHaveClass('text-foreground-muted');
});
});
});

0 comments on commit afd2741

Please sign in to comment.