@@ -5556,6 +5556,55 @@ describe('TransactionController', () => {
5556
5556
expect ( updatedTransaction ?. txParams . gasPrice ) . toBe ( '0x5678' ) ;
5557
5557
expect ( updatedTransaction ?. userFeeLevel ) . toBe ( 'custom' ) ;
5558
5558
} ) ;
5559
+
5560
+ it ( 'does not update transaction gas estimates when isAutomaticGasFeeUpdateEnabled returns false' , ( ) => {
5561
+ const transactionId = '1' ;
5562
+
5563
+ const { controller } = setupController ( {
5564
+ options : {
5565
+ isAutomaticGasFeeUpdateEnabled : ( ) => false ,
5566
+ state : {
5567
+ transactions : [
5568
+ {
5569
+ id : transactionId ,
5570
+ chainId : '0x1' ,
5571
+ networkClientId : NETWORK_CLIENT_ID_MOCK ,
5572
+ time : 123456789 ,
5573
+ status : TransactionStatus . unapproved as const ,
5574
+ gasFeeEstimates : {
5575
+ type : GasFeeEstimateType . Legacy ,
5576
+ low : '0x1' ,
5577
+ medium : '0x2' ,
5578
+ high : '0x3' ,
5579
+ } ,
5580
+ txParams : {
5581
+ type : TransactionEnvelopeType . legacy ,
5582
+ from : ACCOUNT_MOCK ,
5583
+ to : ACCOUNT_2_MOCK ,
5584
+ gasPrice : '0x1234' ,
5585
+ } ,
5586
+ } ,
5587
+ ] ,
5588
+ } ,
5589
+ } ,
5590
+ updateToInitialState : true ,
5591
+ } ) ;
5592
+
5593
+ controller . updateTransactionGasFees ( transactionId , {
5594
+ userFeeLevel : GasFeeEstimateLevel . Medium ,
5595
+ gasPrice : '0x5678' ,
5596
+ } ) ;
5597
+
5598
+ expect ( updateTransactionGasEstimatesMock ) . not . toHaveBeenCalled ( ) ;
5599
+
5600
+ const updatedTransaction = controller . state . transactions . find (
5601
+ ( { id } ) => id === transactionId ,
5602
+ ) ;
5603
+ expect ( updatedTransaction ?. txParams . gasPrice ) . toBe ( '0x5678' ) ;
5604
+ expect ( updatedTransaction ?. userFeeLevel ) . toBe (
5605
+ GasFeeEstimateLevel . Medium ,
5606
+ ) ;
5607
+ } ) ;
5559
5608
} ) ;
5560
5609
} ) ;
5561
5610
0 commit comments