1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-22 18:00:18 +01:00

Fixing warnings in unit test cases (#13349)

This commit is contained in:
Jyoti Puri 2022-01-20 00:04:22 +05:30 committed by GitHub
parent af848dec9b
commit 5b5b2cd7df
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 50 additions and 40 deletions

View File

@ -1,4 +1,4 @@
import React from 'react';
import React, { useMemo } from 'react';
import PropTypes from 'prop-types';
import {
EDIT_GAS_MODES,
@ -24,7 +24,7 @@ const EditGasToolTip = ({
transaction,
t,
}) => {
const toolTipMessage = () => {
const toolTipMessage = useMemo(() => {
switch (priorityLevel) {
case PRIORITY_LEVELS.LOW:
return t('lowGasSettingToolTipMessage', [
@ -76,7 +76,8 @@ const EditGasToolTip = ({
default:
return '';
}
};
}, [editGasMode, estimateGreaterThanGasUse, priorityLevel, transaction, t]);
return (
<div className="edit-gas-tooltip__container">
{priorityLevel !== PRIORITY_LEVELS.CUSTOM &&
@ -97,9 +98,11 @@ const EditGasToolTip = ({
</Typography>
</div>
) : null}
{toolTipMessage && (
<div className="edit-gas-tooltip__container__message">
<Typography variant={TYPOGRAPHY.H7}>{toolTipMessage()}</Typography>
<Typography variant={TYPOGRAPHY.H7}>{toolTipMessage}</Typography>
</div>
)}
{priorityLevel === PRIORITY_LEVELS.CUSTOM ||
estimateGreaterThanGasUse ? null : (
<div className="edit-gas-tooltip__container__values">
@ -111,6 +114,7 @@ const EditGasToolTip = ({
>
{t('maxBaseFee')}
</Typography>
{maxFeePerGas && (
<Typography
variant={TYPOGRAPHY.H7}
color={COLORS.NEUTRAL_GREY}
@ -118,6 +122,7 @@ const EditGasToolTip = ({
>
{maxFeePerGas}
</Typography>
)}
</div>
<div>
<Typography
@ -127,6 +132,7 @@ const EditGasToolTip = ({
>
{t('priorityFeeProperCase')}
</Typography>
{maxPriorityFeePerGas && (
<Typography
variant={TYPOGRAPHY.H7}
color={COLORS.NEUTRAL_GREY}
@ -134,6 +140,7 @@ const EditGasToolTip = ({
>
{maxPriorityFeePerGas}
</Typography>
)}
</div>
<div>
<Typography
@ -143,6 +150,7 @@ const EditGasToolTip = ({
>
{t('gasLimit')}
</Typography>
{gasLimit && (
<Typography
variant={TYPOGRAPHY.H7}
color={COLORS.NEUTRAL_GREY}
@ -150,6 +158,7 @@ const EditGasToolTip = ({
>
{gasLimit}
</Typography>
)}
</div>
</div>
)}

View File

@ -1,4 +1,4 @@
import React from 'react';
import React, { useMemo } from 'react';
import { uniq } from 'lodash';
import { roundToDecimalPlacesRemovingExtraZeroes } from '../../../../../helpers/utils/util';
import { useGasFeeContext } from '../../../../../contexts/gasFee';
@ -8,7 +8,7 @@ import { PriorityFeeTooltip } from '../tooltips';
export default function LatestPriorityFeeField() {
const { gasFeeEstimates } = useGasFeeContext();
const renderPriorityFeeRange = () => {
const priorityFeeRange = useMemo(() => {
const { latestPriorityFeeRange } = gasFeeEstimates;
if (latestPriorityFeeRange) {
const formattedRange = uniq([
@ -18,12 +18,14 @@ export default function LatestPriorityFeeField() {
return `${formattedRange} GWEI`;
}
return null;
};
}, [gasFeeEstimates]);
return (
<div className="network-statistics__info__field latest-priority-fee-field">
<span className="network-statistics__info__field-data">
<PriorityFeeTooltip>{renderPriorityFeeRange()}</PriorityFeeTooltip>
{priorityFeeRange && (
<PriorityFeeTooltip>{priorityFeeRange}</PriorityFeeTooltip>
)}
</span>
<span className="network-statistics__info__field-label">
<I18nValue messageKey="priorityFee" />

View File

@ -30,13 +30,12 @@ const NetworkStatistics = () => {
<div className="network-statistics__info">
<div className="network-statistics__info__field">
<span className="network-statistics__info__field-data">
<BaseFeeTooltip>
{gasFeeEstimates?.estimatedBaseFee &&
`${roundToDecimalPlacesRemovingExtraZeroes(
{gasFeeEstimates?.estimatedBaseFee && (
<BaseFeeTooltip>{`${roundToDecimalPlacesRemovingExtraZeroes(
gasFeeEstimates?.estimatedBaseFee,
0,
)} GWEI`}
</BaseFeeTooltip>
)} GWEI`}</BaseFeeTooltip>
)}
</span>
<span className="network-statistics__info__field-label">
<I18nValue messageKey="baseFee" />

View File

@ -35,7 +35,7 @@ export default function FeeCard({
onQuotesClick,
chainId,
isBestQuote,
supportsEIP1559V2,
supportsEIP1559V2 = false,
}) {
const t = useContext(I18nContext);
@ -211,5 +211,5 @@ FeeCard.propTypes = {
numberOfQuotes: PropTypes.number.isRequired,
chainId: PropTypes.string.isRequired,
isBestQuote: PropTypes.bool.isRequired,
supportsEIP1559V2: PropTypes.bool.isRequired,
supportsEIP1559V2: PropTypes.bool,
};