From b7fa514cc6d9486e8f2885dcb73df6e7aa0adf56 Mon Sep 17 00:00:00 2001 From: Pedro Figueiredo Date: Fri, 7 Feb 2025 11:44:02 +0000 Subject: [PATCH] fix: Hide network fee fiat conversion on test nets --- .../tests/transaction/gas-estimates.spec.js | 48 ++++++++++++++++--- test/e2e/tests/transaction/send-edit.spec.js | 9 +++- .../edit-gas-fees-row/edit-gas-fees-row.tsx | 24 +++++----- .../info/shared/gas-fees-row/gas-fees-row.tsx | 12 ++--- 4 files changed, 68 insertions(+), 25 deletions(-) diff --git a/test/e2e/tests/transaction/gas-estimates.spec.js b/test/e2e/tests/transaction/gas-estimates.spec.js index e65ee39dcea6..7ce6037788ed 100644 --- a/test/e2e/tests/transaction/gas-estimates.spec.js +++ b/test/e2e/tests/transaction/gas-estimates.spec.js @@ -20,7 +20,13 @@ describe('Gas estimates generated by MetaMask', function () { it('show expected gas defaults', async function () { await withFixtures( { - fixtures: new FixtureBuilder().build(), + fixtures: new FixtureBuilder() + .withPreferencesController({ + preferences: { + showFiatInTestnets: true, + }, + }) + .build(), ganacheOptions: postLondonGanacheOptions, title: this.test.fullTitle(), }, @@ -55,7 +61,13 @@ describe('Gas estimates generated by MetaMask', function () { it('show expected gas defaults when API is down', async function () { await withFixtures( { - fixtures: new FixtureBuilder().build(), + fixtures: new FixtureBuilder() + .withPreferencesController({ + preferences: { + showFiatInTestnets: true, + }, + }) + .build(), ganacheOptions: postLondonGanacheOptions, testSpecificMock: (mockServer) => { mockServer @@ -101,7 +113,13 @@ describe('Gas estimates generated by MetaMask', function () { it('show expected gas defaults when the network is not supported', async function () { await withFixtures( { - fixtures: new FixtureBuilder().build(), + fixtures: new FixtureBuilder() + .withPreferencesController({ + preferences: { + showFiatInTestnets: true, + }, + }) + .build(), ganacheOptions: postLondonGanacheOptions, testSpecificMock: (mockServer) => { mockServer @@ -146,7 +164,13 @@ describe('Gas estimates generated by MetaMask', function () { it('show expected gas defaults on a network supported by legacy gas API', async function () { await withFixtures( { - fixtures: new FixtureBuilder().build(), + fixtures: new FixtureBuilder() + .withPreferencesController({ + preferences: { + showFiatInTestnets: true, + }, + }) + .build(), ganacheOptions: { ...preLondonGanacheOptions, chainId: parseInt(CHAIN_IDS.BSC, 16), @@ -182,7 +206,13 @@ describe('Gas estimates generated by MetaMask', function () { it('show expected gas defaults on a network supported by legacy gas API when that API is down', async function () { await withFixtures( { - fixtures: new FixtureBuilder().build(), + fixtures: new FixtureBuilder() + .withPreferencesController({ + preferences: { + showFiatInTestnets: true, + }, + }) + .build(), ganacheOptions: { ...preLondonGanacheOptions, chainId: parseInt(CHAIN_IDS.BSC, 16), @@ -232,7 +262,13 @@ describe('Gas estimates generated by MetaMask', function () { it('show expected gas defaults on a network not supported by legacy gas API', async function () { await withFixtures( { - fixtures: new FixtureBuilder().build(), + fixtures: new FixtureBuilder() + .withPreferencesController({ + preferences: { + showFiatInTestnets: true, + }, + }) + .build(), ganacheOptions: preLondonGanacheOptions, title: this.test.fullTitle(), }, diff --git a/test/e2e/tests/transaction/send-edit.spec.js b/test/e2e/tests/transaction/send-edit.spec.js index 31970c0dfaff..d1666995cedd 100644 --- a/test/e2e/tests/transaction/send-edit.spec.js +++ b/test/e2e/tests/transaction/send-edit.spec.js @@ -15,7 +15,14 @@ describe('Editing Confirm Transaction', function () { it('goes back from confirm page to edit eth value, gas price and gas limit', async function () { await withFixtures( { - fixtures: new FixtureBuilder().withConversionRateDisabled().build(), + fixtures: new FixtureBuilder() + .withPreferencesController({ + preferences: { + showFiatInTestnets: true, + }, + }) + .withConversionRateDisabled() + .build(), ganacheOptions: defaultGanacheOptions, title: this.test.fullTitle(), }, diff --git a/ui/pages/confirmations/components/confirm/info/shared/edit-gas-fees-row/edit-gas-fees-row.tsx b/ui/pages/confirmations/components/confirm/info/shared/edit-gas-fees-row/edit-gas-fees-row.tsx index 2d3697c6f949..aaa33e87140d 100644 --- a/ui/pages/confirmations/components/confirm/info/shared/edit-gas-fees-row/edit-gas-fees-row.tsx +++ b/ui/pages/confirmations/components/confirm/info/shared/edit-gas-fees-row/edit-gas-fees-row.tsx @@ -70,8 +70,17 @@ export const EditGasFeesRow = ({ {nativeFee} {(!isTestnet || showFiatInTestnets) && - fiatFeeWith18SignificantDigits ? ( - + (fiatFeeWith18SignificantDigits ? ( + + + {fiatFee} + + + ) : ( {fiatFee} - - ) : ( - - {fiatFee} - - )} + ))} ); diff --git a/ui/pages/confirmations/components/confirm/info/shared/gas-fees-row/gas-fees-row.tsx b/ui/pages/confirmations/components/confirm/info/shared/gas-fees-row/gas-fees-row.tsx index 2bcbe7fb2b35..b5856478fbde 100644 --- a/ui/pages/confirmations/components/confirm/info/shared/gas-fees-row/gas-fees-row.tsx +++ b/ui/pages/confirmations/components/confirm/info/shared/gas-fees-row/gas-fees-row.tsx @@ -62,13 +62,13 @@ export const GasFeesRow = ({ {nativeFee} {(!isTestnet || showFiatInTestnets) && - fiatFeeWith18SignificantDigits ? ( - + (fiatFeeWith18SignificantDigits ? ( + + {fiatFee} + + ) : ( {fiatFee} - - ) : ( - {fiatFee} - )} + ))} );