gpu-compute-chain/x/cosmostest/module_test.go.bak

43 lines
1.3 KiB
Go

package cosmostest
import (
"cosmos-test/x/cosmostest/types"
"testing"
"time"
"github.com/cosmos/cosmos-sdk/baseapp"
sdk "github.com/cosmos/cosmos-sdk/types"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
"github.com/stretchr/testify/suite"
tendermintTypes "github.com/tendermint/tendermint/proto/tendermint/types"
)
// Integration Tests Tutorial:
// https://tutorials.cosmos.network/academy/3-my-own-chain/game-wager.html#integration-tests
// Example integration test suite:
// https://github.com/cosmos/cosmos-sdk/blob/9e1ec7b/x/bank/keeper/keeper_test.go#L66-L110
type IntegrationTestSuite struct {
suite.Suite
app *AppModule
msgServer types.MsgServer
ctx sdk.Context
queryClient types.QueryClient
}
func (suite *IntegrationTestSuite) SetupTest() {
suite.ctx = suite.app.NewContext(false, tendermintTypes.Header{Time: time.Now()})
suite.app.AccountKeeper.SetParams(suite.ctx, authtypes.DefaultParams())
suite.app.BankKeeper.SetParams(suite.ctx, banktypes.DefaultParams())
queryHelper := baseapp.NewQueryServerTestHelper(suite.ctx, suite.app.InterfaceRegistry())
types.RegisterQueryServer(queryHelper)
suite.queryClient = types.NewQueryClient(queryHelper)
}
func TestKeeperTestSuite(t *testing.T) {
suite.Run(t, new(IntegrationTestSuite))
}