From 1454a72d5c270623dee1d8ed7b0d6cc6b01d34b4 Mon Sep 17 00:00:00 2001 From: jason song Date: Mon, 2 Sep 2024 18:38:55 +0900 Subject: [PATCH] test: remove unused logic --- rpc/backend/tx_info_test.go | 44 +++++++++++-------------------------- 1 file changed, 13 insertions(+), 31 deletions(-) diff --git a/rpc/backend/tx_info_test.go b/rpc/backend/tx_info_test.go index 5cd0fa46fa..26cb4db942 100644 --- a/rpc/backend/tx_info_test.go +++ b/rpc/backend/tx_info_test.go @@ -631,14 +631,13 @@ func (suite *BackendTestSuite) TestCheckChainIdWithTransactionReceipt() { suite.NoError(err) testCases := []struct { - name string - registerMock func() - tx *evmtypes.MsgEthereumTx - block *types.Block - blockResult *abci.ResponseFinalizeBlock - expTxReceipt map[string]interface{} - expKeyMatchPass bool - expApiPass bool + name string + registerMock func() + tx *evmtypes.MsgEthereumTx + block *types.Block + blockResult *abci.ResponseFinalizeBlock + expTxReceipt map[string]interface{} + expPass bool }{ { "success- Receipts with a different chain ID within a patched height", @@ -686,7 +685,6 @@ func (suite *BackendTestSuite) TestCheckChainIdWithTransactionReceipt() { }, map[string]interface{}(nil), true, - true, }, { "false- Receipts with a different chain ID not in the patched height. expected to return an invalid chain ID", @@ -733,7 +731,6 @@ func (suite *BackendTestSuite) TestCheckChainIdWithTransactionReceipt() { }, }, map[string]interface{}(nil), - false, false, // invalid chain id error }, } @@ -749,30 +746,15 @@ func (suite *BackendTestSuite) TestCheckChainIdWithTransactionReceipt() { suite.Require().NoError(err) txReceipt, err := suite.backend.GetTransactionReceipt(common.HexToHash(tc.tx.Hash)) - if tc.expApiPass { + if tc.expPass { suite.Require().NoError(err) - if tc.expKeyMatchPass { - - // check all expected receipt keys are exist. - for k, _ := range tc.expTxReceipt { - _, keyExist := txReceipt[k] - suite.Require().True(keyExist) - } - - } else { - - anyKeyNotExist := false - // check the receipt keys are exist. - for k, _ := range tc.expTxReceipt { - _, keyExist := txReceipt[k] - if !keyExist { - anyKeyNotExist = true - } - - } - suite.Require().True(anyKeyNotExist) + // if test passes, all expected receipt keys should be exist. + for k, _ := range tc.expTxReceipt { + _, keyExist := txReceipt[k] + suite.Require().True(keyExist) } + } else { suite.Require().Error(err) }