1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00

Fix Jest unit tests ()

* 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:
Daniel 2021-07-30 19:40:41 +02:00 committed by GitHub
parent 24f5cc009b
commit fa703173a0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 10 additions and 4 deletions
ui
components/app/gas-timing
pages/swaps
store

View File

@ -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);
}

View File

@ -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: {

View File

@ -46,6 +46,7 @@ setBackgroundConnection({
setSwapsErrorKey: jest.fn(),
getGasFeeEstimatesAndStartPolling: jest.fn(),
updateTransaction: jest.fn(),
getGasFeeTimeEstimate: jest.fn(),
});
describe('ViewQuote', () => {

View File

@ -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,
);