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
@ -15,7 +15,7 @@ import {
|
|||||||
} from '../../../helpers/constants/design-system';
|
} from '../../../helpers/constants/design-system';
|
||||||
import InfoTooltip from '../../ui/info-tooltip/info-tooltip';
|
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
|
// Once we reach this second threshold, we switch to minutes as a unit
|
||||||
const SECOND_CUTOFF = 90;
|
const SECOND_CUTOFF = 90;
|
||||||
@ -61,7 +61,7 @@ export default function GasTiming({
|
|||||||
priority !== previousMaxPriorityFeePerGas ||
|
priority !== previousMaxPriorityFeePerGas ||
|
||||||
fee !== previousMaxFeePerGas
|
fee !== previousMaxFeePerGas
|
||||||
) {
|
) {
|
||||||
getGasTimeEstimate(priority, fee).then((result) => {
|
getGasFeeTimeEstimate(priority, fee).then((result) => {
|
||||||
if (maxFeePerGas === fee && maxPriorityFeePerGas === priority) {
|
if (maxFeePerGas === fee && maxPriorityFeePerGas === priority) {
|
||||||
setCustomEstimatedTime(result);
|
setCustomEstimatedTime(result);
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,7 @@ import thunk from 'redux-thunk';
|
|||||||
import {
|
import {
|
||||||
renderWithProvider,
|
renderWithProvider,
|
||||||
createSwapsMockStore,
|
createSwapsMockStore,
|
||||||
|
setBackgroundConnection,
|
||||||
MOCKS,
|
MOCKS,
|
||||||
} from '../../../../test/jest';
|
} from '../../../../test/jest';
|
||||||
import { MAINNET_CHAIN_ID } from '../../../../shared/constants/network';
|
import { MAINNET_CHAIN_ID } from '../../../../shared/constants/network';
|
||||||
@ -25,6 +26,10 @@ jest.mock('../../../hooks/useGasFeeEstimates', () => {
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
setBackgroundConnection({
|
||||||
|
getGasFeeTimeEstimate: jest.fn(),
|
||||||
|
});
|
||||||
|
|
||||||
const createProps = (customProps = {}) => {
|
const createProps = (customProps = {}) => {
|
||||||
return {
|
return {
|
||||||
primaryFee: {
|
primaryFee: {
|
||||||
|
@ -46,6 +46,7 @@ setBackgroundConnection({
|
|||||||
setSwapsErrorKey: jest.fn(),
|
setSwapsErrorKey: jest.fn(),
|
||||||
getGasFeeEstimatesAndStartPolling: jest.fn(),
|
getGasFeeEstimatesAndStartPolling: jest.fn(),
|
||||||
updateTransaction: jest.fn(),
|
updateTransaction: jest.fn(),
|
||||||
|
getGasFeeTimeEstimate: jest.fn(),
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('ViewQuote', () => {
|
describe('ViewQuote', () => {
|
||||||
|
@ -2791,8 +2791,8 @@ export function disconnectGasFeeEstimatePoller(pollToken) {
|
|||||||
return promisifiedBackground.disconnectGasFeeEstimatePoller(pollToken);
|
return promisifiedBackground.disconnectGasFeeEstimatePoller(pollToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getGasTimeEstimate(maxPriorityFeePerGas, maxFeePerGas) {
|
export function getGasFeeTimeEstimate(maxPriorityFeePerGas, maxFeePerGas) {
|
||||||
return promisifiedBackground.getGasTimeEstimate(
|
return promisifiedBackground.getGasFeeTimeEstimate(
|
||||||
maxPriorityFeePerGas,
|
maxPriorityFeePerGas,
|
||||||
maxFeePerGas,
|
maxFeePerGas,
|
||||||
);
|
);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user