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>
feature/default_network_editable
Daniel 3 years ago committed by GitHub
parent 24f5cc009b
commit fa703173a0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      ui/components/app/gas-timing/gas-timing.component.js
  2. 5
      ui/pages/swaps/fee-card/fee-card.test.js
  3. 1
      ui/pages/swaps/view-quote/view-quote.test.js
  4. 4
      ui/store/actions.js

@ -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…
Cancel
Save