Skip to content

Commit

Permalink
fix: Hide network fee fiat conversion on test nets
Browse files Browse the repository at this point in the history
  • Loading branch information
pedronfigueiredo committed Feb 7, 2025
1 parent 335b3bb commit b7fa514
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 25 deletions.
48 changes: 42 additions & 6 deletions test/e2e/tests/transaction/gas-estimates.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
},
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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),
Expand Down Expand Up @@ -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),
Expand Down Expand Up @@ -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(),
},
Expand Down
9 changes: 8 additions & 1 deletion test/e2e/tests/transaction/send-edit.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,25 +70,25 @@ export const EditGasFeesRow = ({
{nativeFee}
</Text>
{(!isTestnet || showFiatInTestnets) &&
fiatFeeWith18SignificantDigits ? (
<Tooltip title={fiatFeeWith18SignificantDigits}>
(fiatFeeWith18SignificantDigits ? (
<Tooltip title={fiatFeeWith18SignificantDigits}>
<Text
marginRight={2}
color={TextColor.textAlternative}
data-testid="native-currency"
>
{fiatFee}
</Text>
</Tooltip>
) : (
<Text
marginRight={2}
color={TextColor.textAlternative}
data-testid="native-currency"
>
{fiatFee}
</Text>
</Tooltip>
) : (
<Text
marginRight={2}
color={TextColor.textAlternative}
data-testid="native-currency"
>
{fiatFee}
</Text>
)}
))}
</Box>
</ConfirmInfoAlertRow>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,13 @@ export const GasFeesRow = ({
{nativeFee}
</Text>
{(!isTestnet || showFiatInTestnets) &&
fiatFeeWith18SignificantDigits ? (
<Tooltip title={fiatFeeWith18SignificantDigits}>
(fiatFeeWith18SignificantDigits ? (
<Tooltip title={fiatFeeWith18SignificantDigits}>
<Text color={TextColor.textAlternative}>{fiatFee}</Text>
</Tooltip>
) : (
<Text color={TextColor.textAlternative}>{fiatFee}</Text>
</Tooltip>
) : (
<Text color={TextColor.textAlternative}>{fiatFee}</Text>
)}
))}
</Box>
</ConfirmInfoRow>
);
Expand Down

0 comments on commit b7fa514

Please sign in to comment.