cosmos-sdk/x/staking/module_test.go
Facundo Medica af3122aa6c
feat!: Provide logger through depinject (#15818)
Co-authored-by: Julien Robert <julien@rbrt.fr>
2023-04-24 09:42:55 +00:00

34 lines
1.0 KiB
Go

package staking_test
import (
"testing"
"cosmossdk.io/depinject"
"cosmossdk.io/log"
cmtproto "github.com/cometbft/cometbft/proto/tendermint/types"
"github.com/stretchr/testify/require"
simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims"
authKeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
"github.com/cosmos/cosmos-sdk/x/staking/testutil"
"github.com/cosmos/cosmos-sdk/x/staking/types"
)
func TestItCreatesModuleAccountOnInitBlock(t *testing.T) {
var accountKeeper authKeeper.AccountKeeper
app, err := simtestutil.SetupAtGenesis(
depinject.Configs(
testutil.AppConfig,
depinject.Supply(log.NewNopLogger()),
), &accountKeeper)
require.NoError(t, err)
ctx := app.BaseApp.NewContext(false, cmtproto.Header{})
acc := accountKeeper.GetAccount(ctx, authtypes.NewModuleAddress(types.BondedPoolName))
require.NotNil(t, acc)
acc = accountKeeper.GetAccount(ctx, authtypes.NewModuleAddress(types.NotBondedPoolName))
require.NotNil(t, acc)
}