Skip to content

Commit

Permalink
fix unit tests missing mocks
Browse files Browse the repository at this point in the history
  • Loading branch information
skosito committed Oct 25, 2024
1 parent e60cb0f commit e31af80
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
11 changes: 11 additions & 0 deletions rpc/backend/call_tx_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ func (suite *BackendTestSuite) TestResend() {
gasPrice := new(hexutil.Big)
toAddr := tests.GenerateAddress()
chainID := (*hexutil.Big)(suite.backend.chainID)
validator := sdk.AccAddress(tests.GenerateAddress().Bytes())
callArgs := evmtypes.TransactionArgs{
From: nil,
To: &toAddr,
Expand Down Expand Up @@ -69,6 +70,7 @@ func (suite *BackendTestSuite) TestResend() {
RegisterBlock(client, 1, nil)
RegisterBlockResults(client, 1)
RegisterBaseFeeDisabled(queryClient)
RegisterValidatorAccount(queryClient, validator)
},
evmtypes.TransactionArgs{
Nonce: &txNonce,
Expand All @@ -91,6 +93,7 @@ func (suite *BackendTestSuite) TestResend() {
RegisterBlock(client, 1, nil)
RegisterBlockResults(client, 1)
RegisterBaseFee(queryClient, baseFee)
RegisterValidatorAccount(queryClient, validator)
},
evmtypes.TransactionArgs{
Nonce: &txNonce,
Expand All @@ -110,6 +113,7 @@ func (suite *BackendTestSuite) TestResend() {
RegisterBlock(client, 1, nil)
RegisterBlockResults(client, 1)
RegisterBaseFeeDisabled(queryClient)
RegisterValidatorAccount(queryClient, validator)
},
evmtypes.TransactionArgs{
Nonce: &txNonce,
Expand Down Expand Up @@ -163,6 +167,7 @@ func (suite *BackendTestSuite) TestResend() {
RegisterBlock(client, 1, nil)
RegisterBlockResults(client, 1)
RegisterBaseFee(queryClient, baseFee)
RegisterValidatorAccount(queryClient, validator)
},
evmtypes.TransactionArgs{
Nonce: &txNonce,
Expand All @@ -186,6 +191,7 @@ func (suite *BackendTestSuite) TestResend() {
RegisterBlock(client, 1, nil)
RegisterBlockResults(client, 1)
RegisterBaseFee(queryClient, baseFee)
RegisterValidatorAccount(queryClient, validator)
},
evmtypes.TransactionArgs{
Nonce: &txNonce,
Expand All @@ -210,6 +216,7 @@ func (suite *BackendTestSuite) TestResend() {
RegisterParams(queryClient, &header, 1)
RegisterParamsWithoutHeader(queryClient, 1)
RegisterUnconfirmedTxsError(client, nil)
RegisterValidatorAccount(queryClient, validator)
},
evmtypes.TransactionArgs{
Nonce: &txNonce,
Expand Down Expand Up @@ -238,6 +245,7 @@ func (suite *BackendTestSuite) TestResend() {
RegisterParams(queryClient, &header, 1)
RegisterParamsWithoutHeader(queryClient, 1)
RegisterUnconfirmedTxsEmpty(client, nil)
RegisterValidatorAccount(queryClient, validator)
},
evmtypes.TransactionArgs{
Nonce: &txNonce,
Expand Down Expand Up @@ -448,6 +456,7 @@ func (suite *BackendTestSuite) TestDoCall() {

func (suite *BackendTestSuite) TestGasPrice() {
defaultGasPrice := (*hexutil.Big)(big.NewInt(1))
validator := sdk.AccAddress(tests.GenerateAddress().Bytes())

testCases := []struct {
name string
Expand All @@ -467,6 +476,7 @@ func (suite *BackendTestSuite) TestGasPrice() {
RegisterBlock(client, 1, nil)
RegisterBlockResults(client, 1)
RegisterBaseFee(queryClient, sdk.NewInt(1))
RegisterValidatorAccount(queryClient, validator)
},
defaultGasPrice,
true,
Expand All @@ -483,6 +493,7 @@ func (suite *BackendTestSuite) TestGasPrice() {
RegisterBlock(client, 1, nil)
RegisterBlockResults(client, 1)
RegisterBaseFee(queryClient, sdk.NewInt(1))
RegisterValidatorAccount(queryClient, validator)
},
defaultGasPrice,
false,
Expand Down
4 changes: 4 additions & 0 deletions rpc/backend/sign_tx_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ func (suite *BackendTestSuite) TestSendTransaction() {
from := common.BytesToAddress(priv.PubKey().Address().Bytes())
nonce := hexutil.Uint64(1)
baseFee := sdk.NewInt(1)
validator := sdk.AccAddress(tests.GenerateAddress().Bytes())
callArgsDefault := evmtypes.TransactionArgs{
From: &from,
To: &toAddr,
Expand Down Expand Up @@ -82,6 +83,7 @@ func (suite *BackendTestSuite) TestSendTransaction() {
RegisterBlock(client, 1, nil)
RegisterBlockResults(client, 1)
RegisterBaseFee(queryClient, baseFee)
RegisterValidatorAccount(queryClient, validator)
},
evmtypes.TransactionArgs{
From: &from,
Expand Down Expand Up @@ -115,6 +117,7 @@ func (suite *BackendTestSuite) TestSendTransaction() {
txBytes, err := txEncoder(tx)
suite.Require().NoError(err)
RegisterBroadcastTxError(client, txBytes)
RegisterValidatorAccount(queryClient, validator)
},
callArgsDefault,
common.Hash{},
Expand Down Expand Up @@ -142,6 +145,7 @@ func (suite *BackendTestSuite) TestSendTransaction() {
txBytes, err := txEncoder(tx)
suite.Require().NoError(err)
RegisterBroadcastTx(client, txBytes)
RegisterValidatorAccount(queryClient, validator)
},
callArgsDefault,
hash,
Expand Down

0 comments on commit e31af80

Please sign in to comment.