mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Fix Jest unit tests (#11687)
* Fix Jest unit tests * Provider correct getGasFeeTimeEstimate call to Gas Timing * Fix tests for correct getGasFeeTimeEstimate method name * Rename instances to getGasFeeTimeEstimate Co-authored-by: David Walsh <davidwalsh83@gmail.com> Co-authored-by: Dan Miller <danjm.com@gmail.com>
This commit is contained in:
parent
24f5cc009b
commit
fa703173a0
ui
components/app/gas-timing
pages/swaps
store
@ -15,7 +15,7 @@ import {
|
||||
} from '../../../helpers/constants/design-system';
|
||||
import InfoTooltip from '../../ui/info-tooltip/info-tooltip';
|
||||
|
||||
import { getGasTimeEstimate } from '../../../store/actions';
|
||||
import { getGasFeeTimeEstimate } from '../../../store/actions';
|
||||
|
||||
// Once we reach this second threshold, we switch to minutes as a unit
|
||||
const SECOND_CUTOFF = 90;
|
||||
@ -61,7 +61,7 @@ export default function GasTiming({
|
||||
priority !== previousMaxPriorityFeePerGas ||
|
||||
fee !== previousMaxFeePerGas
|
||||
) {
|
||||
getGasTimeEstimate(priority, fee).then((result) => {
|
||||
getGasFeeTimeEstimate(priority, fee).then((result) => {
|
||||
if (maxFeePerGas === fee && maxPriorityFeePerGas === priority) {
|
||||
setCustomEstimatedTime(result);
|
||||
}
|
||||
|
@ -5,6 +5,7 @@ import thunk from 'redux-thunk';
|
||||
import {
|
||||
renderWithProvider,
|
||||
createSwapsMockStore,
|
||||
setBackgroundConnection,
|
||||
MOCKS,
|
||||
} from '../../../../test/jest';
|
||||
import { MAINNET_CHAIN_ID } from '../../../../shared/constants/network';
|
||||
@ -25,6 +26,10 @@ jest.mock('../../../hooks/useGasFeeEstimates', () => {
|
||||
};
|
||||
});
|
||||
|
||||
setBackgroundConnection({
|
||||
getGasFeeTimeEstimate: jest.fn(),
|
||||
});
|
||||
|
||||
const createProps = (customProps = {}) => {
|
||||
return {
|
||||
primaryFee: {
|
||||
|
@ -46,6 +46,7 @@ setBackgroundConnection({
|
||||
setSwapsErrorKey: jest.fn(),
|
||||
getGasFeeEstimatesAndStartPolling: jest.fn(),
|
||||
updateTransaction: jest.fn(),
|
||||
getGasFeeTimeEstimate: jest.fn(),
|
||||
});
|
||||
|
||||
describe('ViewQuote', () => {
|
||||
|
@ -2791,8 +2791,8 @@ export function disconnectGasFeeEstimatePoller(pollToken) {
|
||||
return promisifiedBackground.disconnectGasFeeEstimatePoller(pollToken);
|
||||
}
|
||||
|
||||
export function getGasTimeEstimate(maxPriorityFeePerGas, maxFeePerGas) {
|
||||
return promisifiedBackground.getGasTimeEstimate(
|
||||
export function getGasFeeTimeEstimate(maxPriorityFeePerGas, maxFeePerGas) {
|
||||
return promisifiedBackground.getGasFeeTimeEstimate(
|
||||
maxPriorityFeePerGas,
|
||||
maxFeePerGas,
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user