diff --git a/packages/transaction-controller/src/TransactionController.test.ts b/packages/transaction-controller/src/TransactionController.test.ts index 15a3d8e1954..cb724d406bb 100644 --- a/packages/transaction-controller/src/TransactionController.test.ts +++ b/packages/transaction-controller/src/TransactionController.test.ts @@ -5489,6 +5489,55 @@ describe('TransactionController', () => { expect(updatedTransaction?.txParams.gasPrice).toBe('0x5678'); expect(updatedTransaction?.userFeeLevel).toBe('custom'); }); + + it('does not update transaction gas estimates when isAutomaticGasFeeUpdateEnabled returns false', () => { + const transactionId = '1'; + + const { controller } = setupController({ + options: { + isAutomaticGasFeeUpdateEnabled: () => false, + state: { + transactions: [ + { + id: transactionId, + chainId: '0x1', + networkClientId: NETWORK_CLIENT_ID_MOCK, + time: 123456789, + status: TransactionStatus.unapproved as const, + gasFeeEstimates: { + type: GasFeeEstimateType.Legacy, + low: '0x1', + medium: '0x2', + high: '0x3', + }, + txParams: { + type: TransactionEnvelopeType.legacy, + from: ACCOUNT_MOCK, + to: ACCOUNT_2_MOCK, + gasPrice: '0x1234', + }, + }, + ], + }, + }, + updateToInitialState: true, + }); + + controller.updateTransactionGasFees(transactionId, { + userFeeLevel: GasFeeEstimateLevel.Medium, + gasPrice: '0x5678', + }); + + expect(updateTransactionGasEstimatesMock).not.toHaveBeenCalled(); + + const updatedTransaction = controller.state.transactions.find( + ({ id }) => id === transactionId, + ); + expect(updatedTransaction?.txParams.gasPrice).toBe('0x5678'); + expect(updatedTransaction?.userFeeLevel).toBe( + GasFeeEstimateLevel.Medium, + ); + }); }); });