Skip to content

Commit

Permalink
test: remove unused logic
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonsong0 committed Sep 2, 2024
1 parent c09f332 commit 1454a72
Showing 1 changed file with 13 additions and 31 deletions.
44 changes: 13 additions & 31 deletions rpc/backend/tx_info_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -733,7 +731,6 @@ func (suite *BackendTestSuite) TestCheckChainIdWithTransactionReceipt() {
},
},
map[string]interface{}(nil),
false,
false, // invalid chain id error
},
}
Expand All @@ -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)
}
Expand Down

0 comments on commit 1454a72

Please sign in to comment.