50 lines
1.5 KiB
Go
50 lines
1.5 KiB
Go
|
// Reference file.
|
||
|
|
||
|
package keeper
|
||
|
|
||
|
import (
|
||
|
"colinear/x/colinearcore"
|
||
|
"colinear/x/colinearcore/types"
|
||
|
"testing"
|
||
|
"time"
|
||
|
|
||
|
"github.com/cosmos/cosmos-sdk/baseapp"
|
||
|
"github.com/cosmos/cosmos-sdk/codec"
|
||
|
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 colinear.AppModule
|
||
|
msgServer types.MsgServer
|
||
|
ctx sdk.Context
|
||
|
queryClient types.QueryClient
|
||
|
}
|
||
|
|
||
|
func (suite *IntegrationTestSuite) SetupTest() {
|
||
|
suite.app = colinear.AppModule{
|
||
|
Keeper: NewKeeper(cdc)
|
||
|
}
|
||
|
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))
|
||
|
}
|