mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Fix isMainnet
propType error (#12951)
A propType error was showing up during e2e tests with a `testDev` build. It was caused by `process.env.IN_TEST` being treated as a boolean, when in fact it is either the string `'true'` or a boolean. `IN_TEST` has been updated to always be a boolean. `loose-envify` has no trouble injecting boolean values, so there's no reason to treat this as a string.
This commit is contained in:
parent
fac68980e0
commit
7226357422
@ -56,7 +56,7 @@ const openMetamaskTabsIDs = {};
|
||||
const requestAccountTabIds = {};
|
||||
|
||||
// state persistence
|
||||
const inTest = process.env.IN_TEST === 'true';
|
||||
const inTest = process.env.IN_TEST;
|
||||
const localStore = inTest ? new ReadOnlyNetworkStore() : new LocalStore();
|
||||
let versionedData;
|
||||
|
||||
|
@ -10,7 +10,7 @@ import {
|
||||
import { PollingBlockTracker } from 'eth-block-tracker';
|
||||
import { SECOND } from '../../../../shared/constants/time';
|
||||
|
||||
const inTest = process.env.IN_TEST === 'true';
|
||||
const inTest = process.env.IN_TEST;
|
||||
const blockTrackerOpts = inTest ? { pollingInterval: SECOND } : {};
|
||||
const getTestMiddlewares = () => {
|
||||
return inTest ? [createEstimateGasDelayTestMiddleware()] : [];
|
||||
|
@ -33,7 +33,7 @@ const env = process.env.METAMASK_ENV;
|
||||
const fetchWithTimeout = getFetchWithTimeout(SECOND * 30);
|
||||
|
||||
let defaultProviderConfigOpts;
|
||||
if (process.env.IN_TEST === 'true') {
|
||||
if (process.env.IN_TEST) {
|
||||
defaultProviderConfigOpts = {
|
||||
type: NETWORK_TYPE_RPC,
|
||||
rpcUrl: 'http://localhost:8545',
|
||||
|
@ -779,7 +779,7 @@ function getEnvironmentVariables({ buildType, devMode, testing }) {
|
||||
METAMASK_VERSION: version,
|
||||
METAMASK_BUILD_TYPE: buildType,
|
||||
NODE_ENV: devMode ? ENVIRONMENT.DEVELOPMENT : ENVIRONMENT.PRODUCTION,
|
||||
IN_TEST: testing ? 'true' : false,
|
||||
IN_TEST: testing,
|
||||
PUBNUB_SUB_KEY: process.env.PUBNUB_SUB_KEY || '',
|
||||
PUBNUB_PUB_KEY: process.env.PUBNUB_PUB_KEY || '',
|
||||
CONF: devMode ? metamaskrc : {},
|
||||
|
@ -29,7 +29,7 @@ const EditGasFeePopover = () => {
|
||||
className="edit-gas-fee-popover"
|
||||
>
|
||||
<>
|
||||
{process.env.IN_TEST === 'true' ? null : <LoadingHeartBeat />}
|
||||
{process.env.IN_TEST ? null : <LoadingHeartBeat />}
|
||||
<div className="edit-gas-fee-popover__wrapper">
|
||||
<div className="edit-gas-fee-popover__content">
|
||||
{balanceError && (
|
||||
|
@ -261,7 +261,7 @@ export default function EditGasPopover({
|
||||
<EditGasDisplayEducation />
|
||||
) : (
|
||||
<>
|
||||
{process.env.IN_TEST === 'true' ? null : <LoadingHeartBeat />}
|
||||
{process.env.IN_TEST ? null : <LoadingHeartBeat />}
|
||||
<EditGasDisplay
|
||||
showEducationButton={showEducationButton}
|
||||
warning={warning}
|
||||
|
@ -32,7 +32,7 @@ export const getMessage = (localeCode, localeMessages, key, substitutions) => {
|
||||
);
|
||||
Sentry.captureException(missingMessageErrors[key]);
|
||||
log.error(missingMessageErrors[key]);
|
||||
if (process.env.IN_TEST === 'true') {
|
||||
if (process.env.IN_TEST) {
|
||||
throw missingMessageErrors[key];
|
||||
}
|
||||
}
|
||||
|
@ -68,7 +68,7 @@ const EIP_1559_V2_ENABLED =
|
||||
process.env.EIP_1559_V2 === true || process.env.EIP_1559_V2 === 'true';
|
||||
|
||||
const renderHeartBeatIfNotInTest = () =>
|
||||
process.env.IN_TEST === 'true' ? null : <LoadingHeartBeat />;
|
||||
process.env.IN_TEST ? null : <LoadingHeartBeat />;
|
||||
|
||||
export default class ConfirmTransactionBase extends Component {
|
||||
static contextTypes = {
|
||||
|
@ -17,8 +17,7 @@ import TransactionDetailItem from '../../../components/app/transaction-detail-it
|
||||
import UserPreferencedCurrencyDisplay from '../../../components/app/user-preferenced-currency-display';
|
||||
import { useGasFeeContext } from '../../../contexts/gasFee';
|
||||
|
||||
const HeartBeat = () =>
|
||||
process.env.IN_TEST === 'true' ? null : <LoadingHeartBeat />;
|
||||
const HeartBeat = () => (process.env.IN_TEST ? null : <LoadingHeartBeat />);
|
||||
|
||||
const GasDetailsItem = ({
|
||||
hexMaximumTransactionFee,
|
||||
|
@ -22,9 +22,7 @@ const mapStateToProps = (state) => {
|
||||
const showSearchTabCustomNetwork =
|
||||
useTokenDetection && Boolean(Object.keys(tokenList).length);
|
||||
const showSearchTab =
|
||||
getIsMainnet(state) ||
|
||||
showSearchTabCustomNetwork ||
|
||||
process.env.IN_TEST === 'true';
|
||||
getIsMainnet(state) || showSearchTabCustomNetwork || process.env.IN_TEST;
|
||||
return {
|
||||
identities,
|
||||
mostRecentOverviewPage: getMostRecentOverviewPage(state),
|
||||
|
Loading…
Reference in New Issue
Block a user