mirror of
https://github.com/colinear-labs/chain.git
synced 2026-03-05 13:04:24 -08:00
backup old test cases
we're switching to shell tests for now
This commit is contained in:
49
x/cosmostest/keeper/keeper_integration_test.go.bak
Normal file
49
x/cosmostest/keeper/keeper_integration_test.go.bak
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
// Reference file.
|
||||||
|
|
||||||
|
package keeper
|
||||||
|
|
||||||
|
import (
|
||||||
|
"cosmos-test/x/cosmostest"
|
||||||
|
"cosmos-test/x/cosmostest/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 cosmostest.AppModule
|
||||||
|
msgServer types.MsgServer
|
||||||
|
ctx sdk.Context
|
||||||
|
queryClient types.QueryClient
|
||||||
|
}
|
||||||
|
|
||||||
|
func (suite *IntegrationTestSuite) SetupTest() {
|
||||||
|
suite.app = cosmostest.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))
|
||||||
|
}
|
||||||
42
x/cosmostest/module_test.go.bak
Normal file
42
x/cosmostest/module_test.go.bak
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
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))
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user