mirror of
https://github.com/0glabs/0g-chain.git
synced 2024-11-10 18:15:19 +00:00
45 lines
1.1 KiB
Go
45 lines
1.1 KiB
Go
|
package community_test
|
||
|
|
||
|
import (
|
||
|
"testing"
|
||
|
|
||
|
"github.com/stretchr/testify/suite"
|
||
|
|
||
|
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
|
||
|
"github.com/kava-labs/kava/x/community"
|
||
|
"github.com/kava-labs/kava/x/community/testutil"
|
||
|
"github.com/kava-labs/kava/x/community/types"
|
||
|
)
|
||
|
|
||
|
type genesisTestSuite struct {
|
||
|
testutil.Suite
|
||
|
}
|
||
|
|
||
|
func (suite *genesisTestSuite) SetupTest() {
|
||
|
suite.Suite.SetupTest()
|
||
|
}
|
||
|
|
||
|
func TestGenesisTestSuite(t *testing.T) {
|
||
|
suite.Run(t, new(genesisTestSuite))
|
||
|
}
|
||
|
|
||
|
func (suite *genesisTestSuite) TestInitGenesis() {
|
||
|
suite.SetupTest()
|
||
|
|
||
|
accountKeeper := suite.App.GetAccountKeeper()
|
||
|
|
||
|
suite.NotPanics(func() {
|
||
|
community.InitGenesis(suite.Ctx, suite.Keeper, accountKeeper)
|
||
|
})
|
||
|
|
||
|
communityPoolAddress := accountKeeper.GetModuleAddress(types.ModuleAccountName)
|
||
|
// hello, greppers!
|
||
|
suite.Equal("kava17d2wax0zhjrrecvaszuyxdf5wcu5a0p4qlx3t5", communityPoolAddress.String())
|
||
|
|
||
|
// check for module account this way b/c GetModuleAccount creates if not existing.
|
||
|
acc := accountKeeper.GetAccount(suite.Ctx, communityPoolAddress)
|
||
|
suite.NotNil(acc)
|
||
|
_, ok := acc.(authtypes.ModuleAccountI)
|
||
|
suite.True(ok)
|
||
|
}
|