From f587b0d514dad6c351ec83d21d6db3ee96d964b8 Mon Sep 17 00:00:00 2001 From: Dong Lieu Date: Tue, 16 Jan 2024 23:27:35 +0700 Subject: [PATCH] rename variable --- x/multi-staking/keeper/abci_test.go | 24 +++++++++--------------- x/multi-staking/types/genesis_test.go | 9 ++++----- 2 files changed, 13 insertions(+), 20 deletions(-) diff --git a/x/multi-staking/keeper/abci_test.go b/x/multi-staking/keeper/abci_test.go index b4efb46e..052247b1 100644 --- a/x/multi-staking/keeper/abci_test.go +++ b/x/multi-staking/keeper/abci_test.go @@ -1,8 +1,6 @@ package keeper_test import ( - "fmt" - "github.com/realio-tech/multi-staking-module/testutil" "github.com/realio-tech/multi-staking-module/x/multi-staking/types" @@ -16,11 +14,11 @@ func (suite *KeeperTestSuite) TestEndBlocker() { mulStaker := testutil.GenAddress() valAddr := testutil.GenValAddress() - const gasDenom = "ario" + const multiStakingDenom = "ario" - suite.msKeeper.SetValidatorMultiStakingCoin(suite.ctx, valAddr, gasDenom) + suite.msKeeper.SetValidatorMultiStakingCoin(suite.ctx, valAddr, multiStakingDenom) - mulBalance := sdk.NewCoins(sdk.NewCoin(stakingtypes.DefaultParams().BondDenom, sdk.NewInt(10000)), sdk.NewCoin(gasDenom, sdk.NewInt(10000))) + mulBalance := sdk.NewCoins(sdk.NewCoin(stakingtypes.DefaultParams().BondDenom, sdk.NewInt(10000)), sdk.NewCoin(multiStakingDenom, sdk.NewInt(10000))) err := suite.app.BankKeeper.MintCoins(suite.ctx, minttypes.ModuleName, mulBalance) suite.NoError(err) err = suite.app.BankKeeper.SendCoinsFromModuleToAccount(suite.ctx, minttypes.ModuleName, mulStaker, mulBalance) @@ -29,13 +27,13 @@ func (suite *KeeperTestSuite) TestEndBlocker() { unlockEntry := types.UnlockEntry{ CreationHeight: suite.ctx.BlockHeight(), UnlockingCoin: types.MultiStakingCoin{ - Denom: gasDenom, + Denom: multiStakingDenom, Amount: sdk.NewInt(10000), BondWeight: sdk.NewDec(1), }, } newUbd := types.MultiStakingUnlock{ - UnlockID: &types.UnlockID{ + UnlockID: types.UnlockID{ MultiStakerAddr: mulStaker.String(), ValAddr: valAddr.String(), }, @@ -46,24 +44,20 @@ func (suite *KeeperTestSuite) TestEndBlocker() { matureUnbondingDelegations := suite.msKeeper.GetMatureUnbondingDelegations(suite.ctx) completionTime := suite.ctx.BlockHeader().Time - unDT := stakingtypes.UnbondingDelegationEntry{ + unbondingDelegationEntry := stakingtypes.UnbondingDelegationEntry{ CreationHeight: suite.ctx.BlockHeight(), CompletionTime: completionTime, InitialBalance: sdk.NewInt(1000), Balance: sdk.NewInt(1000), } - unD := stakingtypes.UnbondingDelegation{ + unbondingDelegation := stakingtypes.UnbondingDelegation{ DelegatorAddress: mulStaker.String(), ValidatorAddress: valAddr.String(), - Entries: []stakingtypes.UnbondingDelegationEntry{unDT}, + Entries: []stakingtypes.UnbondingDelegationEntry{unbondingDelegationEntry}, } - matureUnbondingDelegations = append(matureUnbondingDelegations, unD) + matureUnbondingDelegations = append(matureUnbondingDelegations, unbondingDelegation) - a := suite.app.AccountKeeper.GetModuleAccount(suite.ctx, "mint") - if a == nil { - fmt.Println("nill") - } suite.msKeeper.EndBlocker(suite.ctx, matureUnbondingDelegations) } diff --git a/x/multi-staking/types/genesis_test.go b/x/multi-staking/types/genesis_test.go index 54d7afd4..846c4d2d 100644 --- a/x/multi-staking/types/genesis_test.go +++ b/x/multi-staking/types/genesis_test.go @@ -13,7 +13,7 @@ import ( func TestGenesisState_Validate(t *testing.T) { multiStakerAddress := testutil.GenAddress() valAddr := testutil.GenValAddress() - denom := "ario" + const multiStakingDenom = "ario" for _, tc := range []struct { desc string @@ -30,12 +30,12 @@ func TestGenesisState_Validate(t *testing.T) { genState: &types.GenesisState{ MultiStakingLocks: []types.MultiStakingLock{ { - LockID: &types.LockID{ + LockID: types.LockID{ MultiStakerAddr: multiStakerAddress.String(), ValAddr: valAddr.String(), }, LockedCoin: types.MultiStakingCoin{ - Denom: denom, + Denom: multiStakingDenom, Amount: sdk.NewInt(1000), BondWeight: sdk.NewDec(1), }, @@ -44,14 +44,13 @@ func TestGenesisState_Validate(t *testing.T) { ValidatorMultiStakingCoins: []types.ValidatorMultiStakingCoin{ { ValAddr: valAddr.String(), - CoinDenom: denom, + CoinDenom: multiStakingDenom, }, }, StakingGenesisState: types.DefaultGenesis().StakingGenesisState, }, valid: true, }, - // this line is used by starport scaffolding # types/genesis/testcase } { t.Run(tc.desc, func(t *testing.T) { err := tc.genState.Validate()