Skip to content
This repository has been archived by the owner on Apr 4, 2024. It is now read-only.

Commit

Permalink
[issue-1018] refactor SetupTest calls (grpc_query_test & statedb_test)
Browse files Browse the repository at this point in the history
  • Loading branch information
GAtom22 committed Oct 21, 2022
1 parent c388186 commit 1a0d732
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
1 change: 0 additions & 1 deletion x/evm/keeper/grpc_query_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1130,7 +1130,6 @@ func (suite *KeeperTestSuite) TestTraceBlock() {
}

func (suite *KeeperTestSuite) TestNonceInQuery() {
suite.SetupTest()
address := tests.GenerateAddress()
suite.Require().Equal(uint64(0), suite.app.EvmKeeper.GetNonce(suite.ctx, address))
supply := sdkmath.NewIntWithDecimal(1000, 18).BigInt()
Expand Down
12 changes: 4 additions & 8 deletions x/evm/keeper/statedb_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -318,16 +318,15 @@ func (suite *KeeperTestSuite) TestSetCode() {
}
}


func (suite *KeeperTestSuite) TestKeeperSetCode() {
addr := tests.GenerateAddress()
baseAcc := &authtypes.BaseAccount{Address: sdk.AccAddress(addr.Bytes()).String()}
suite.app.AccountKeeper.SetAccount(suite.ctx, baseAcc)

testCases := []struct {
name string
name string
codeHash []byte
code []byte
code []byte
}{
{
"set code",
Expand Down Expand Up @@ -420,8 +419,6 @@ func (suite *KeeperTestSuite) TestState() {
}

func (suite *KeeperTestSuite) TestCommittedState() {
suite.SetupTest()

key := common.BytesToHash([]byte("key"))
value1 := common.BytesToHash([]byte("value1"))
value2 := common.BytesToHash([]byte("value2"))
Expand Down Expand Up @@ -523,8 +520,6 @@ func (suite *KeeperTestSuite) TestExist() {
}

func (suite *KeeperTestSuite) TestEmpty() {
suite.SetupTest()

testCases := []struct {
name string
address common.Address
Expand All @@ -543,6 +538,7 @@ func (suite *KeeperTestSuite) TestEmpty() {

for _, tc := range testCases {
suite.Run(tc.name, func() {
suite.SetupTest()
vmdb := suite.StateDB()
tc.malleate(vmdb)

Expand Down Expand Up @@ -907,7 +903,6 @@ func (suite *KeeperTestSuite) TestSetBalance() {
}

func (suite *KeeperTestSuite) TestDeleteAccount() {
suite.SetupTest()
supply := big.NewInt(100)
contractAddr := suite.DeployTestContract(suite.T(), suite.address, supply)

Expand Down Expand Up @@ -935,6 +930,7 @@ func (suite *KeeperTestSuite) TestDeleteAccount() {

for _, tc := range testCases {
suite.Run(tc.name, func() {
suite.SetupTest()
err := suite.app.EvmKeeper.DeleteAccount(suite.ctx, tc.addr)
if tc.expErr {
suite.Require().Error(err)
Expand Down

0 comments on commit 1a0d732

Please sign in to comment.