laconicd-deprecated/x/bond/keeper/keeper_test.go
Sai Kumar d28ef888ff
dxns bond module test (#4)
* WIP : added bond module tx and query cli commands

* added bond module invariant

* update the go.mod

* addressed the pr changes

* update to proto files

* refactor: move the proto package version from `v1` to `v1beta1` for vulcanize modules

* WIP : addin the unit test scripts to bond module

* refactor: refactored the test cases for bond module

* refactor: refactored the bond module test cases
1. refactored grpc gateway  endpoints of bond module
2. added test cases to cli query , cli tx and grpc end points

* addressed the pr comments
1. changed query-by-owner to by-owner in cli cmd
2. changed bonds-by-owner route to by-owner in bond module
2021-09-29 18:18:30 +05:30

47 lines
1.3 KiB
Go

package keeper_test
import (
"github.com/cosmos/cosmos-sdk/baseapp"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/stretchr/testify/require"
"github.com/stretchr/testify/suite"
tmproto "github.com/tendermint/tendermint/proto/tendermint/types"
"github.com/tharsis/ethermint/app"
bondkeeper "github.com/tharsis/ethermint/x/bond/keeper"
"github.com/tharsis/ethermint/x/bond/types"
"testing"
)
type KeeperTestSuite struct {
suite.Suite
app *app.EthermintApp
ctx sdk.Context
queryClient types.QueryClient
}
func (suite *KeeperTestSuite) SetupTest() {
testApp := app.Setup(false)
ctx := testApp.BaseApp.NewContext(false, tmproto.Header{})
querier := bondkeeper.Querier{Keeper: testApp.BondKeeper}
queryHelper := baseapp.NewQueryServerTestHelper(ctx, testApp.InterfaceRegistry())
types.RegisterQueryServer(queryHelper, querier)
queryClient := types.NewQueryClient(queryHelper)
suite.app, suite.ctx, suite.queryClient = testApp, ctx, queryClient
}
func TestParams(t *testing.T) {
testApp := app.Setup(false)
ctx := testApp.BaseApp.NewContext(false, tmproto.Header{})
expParams := types.DefaultParams()
params := testApp.BondKeeper.GetParams(ctx)
require.Equal(t, expParams.MaxBondAmount, params.MaxBondAmount)
}
func TestKeeperTestSuite(t *testing.T) {
suite.Run(t, new(KeeperTestSuite))
}