-
Notifications
You must be signed in to change notification settings - Fork 322
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[WALL] Lubega / WALL-2987 / TransactionStatusError unit test (#13061)
* chore: transaction status error unit test * fix: applied comments * Merge branch 'master' of github.com:binary-com/deriv-app into WALL-2987/transaction-status-error-unit-test * fix: cleaned up code * fix: rerun workflow
- Loading branch information
1 parent
a0aa511
commit bb69546
Showing
2 changed files
with
46 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
...sactionStatus/components/TransactionStatusError/__tests__/TransactionStatusError.spec.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import React from 'react'; | ||
import { fireEvent, render, screen } from '@testing-library/react'; | ||
import TransactionStatusError from '../TransactionStatusError'; | ||
|
||
describe('TransactionStatusError', () => { | ||
it('should render component correctly', () => { | ||
const mockRefresh = jest.fn(); | ||
|
||
render(<TransactionStatusError refresh={mockRefresh} />); | ||
|
||
expect(screen.getByText('Unfortunately, we cannot retrieve the information at this time.')).toBeInTheDocument(); | ||
expect(screen.getByText('Refresh')).toBeInTheDocument(); | ||
}); | ||
|
||
it('should render refresh function on click of refresh button', () => { | ||
const mockRefresh = jest.fn(); | ||
|
||
render(<TransactionStatusError refresh={mockRefresh} />); | ||
|
||
expect(screen.getByText('Unfortunately, we cannot retrieve the information at this time.')).toBeInTheDocument(); | ||
|
||
const refreshButton = screen.getByText('Refresh'); | ||
expect(refreshButton).toBeInTheDocument(); | ||
|
||
fireEvent.click(refreshButton); | ||
expect(mockRefresh).toHaveBeenCalledTimes(1); | ||
}); | ||
}); |