This repository has been archived by the owner on Nov 10, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 362
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Change default gas estimation state from 0 to undefined (#3964)
* fix: Change default gas estimation state from 0 to undefined * fix: Return 0 for maxPrioFee if pre EIP-1559 and gasPrice estimation throws * chore: Add more unit tests
- Loading branch information
1 parent
097d070
commit e19ba47
Showing
8 changed files
with
121 additions
and
36 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
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,31 @@ | ||
import { renderHook } from '@testing-library/react-hooks' | ||
import { waitFor } from 'src/utils/test-utils' | ||
import { EstimationStatus } from 'src/logic/hooks/useEstimateTransactionGas' | ||
import { useEstimationStatus } from 'src/logic/hooks/useEstimationStatus' | ||
import { ButtonStatus } from 'src/components/Modal' | ||
|
||
describe('useEstimationStatus', () => { | ||
it('returns LOADING if estimation is LOADING', async () => { | ||
const { result } = renderHook(() => useEstimationStatus(EstimationStatus.LOADING)) | ||
|
||
await waitFor(() => { | ||
expect(result.current[0]).toBe(ButtonStatus.LOADING) | ||
}) | ||
}) | ||
|
||
it('returns READY if estimation is FAILURE', async () => { | ||
const { result } = renderHook(() => useEstimationStatus(EstimationStatus.FAILURE)) | ||
|
||
await waitFor(() => { | ||
expect(result.current[0]).toBe(ButtonStatus.READY) | ||
}) | ||
}) | ||
|
||
it('returns READY if estimation is SUCCESS', async () => { | ||
const { result } = renderHook(() => useEstimationStatus(EstimationStatus.SUCCESS)) | ||
|
||
await waitFor(() => { | ||
expect(result.current[0]).toBe(ButtonStatus.READY) | ||
}) | ||
}) | ||
}) |
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
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
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
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
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
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