Prathamesh Musale
213c390c37
Some checks failed
Integration Tests / test-integration (push) Successful in 2m48s
E2E Tests / test-e2e (push) Successful in 4m56s
Lint / Run golangci-lint (push) Successful in 5m6s
Unit Tests / test-unit (push) Successful in 3m22s
SDK Tests / sdk_tests_nameservice_expiry (push) Successful in 10m40s
SDK Tests / sdk_tests (push) Successful in 10m55s
SDK Tests / sdk_tests_auctions (push) Failing after 16m7s
Part of https://www.notion.so/Rename-laconic2d-to-laconicd-9028d0c020d24d1288e92ebcb773d7a7 Co-authored-by: neeraj <neeraj.rtly@gmail.com> Reviewed-on: cerc-io/laconic2d#26 Co-authored-by: Prathamesh Musale <prathamesh@noreply.git.vdb.to> Co-committed-by: Prathamesh Musale <prathamesh@noreply.git.vdb.to>
61 lines
1.5 KiB
Go
61 lines
1.5 KiB
Go
package keeper_test
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"cosmossdk.io/math"
|
|
simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims"
|
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
|
"github.com/stretchr/testify/assert"
|
|
"github.com/stretchr/testify/suite"
|
|
|
|
integrationTest "git.vdb.to/cerc-io/laconicd/tests/integration"
|
|
bondTypes "git.vdb.to/cerc-io/laconicd/x/bond"
|
|
types "git.vdb.to/cerc-io/laconicd/x/registry"
|
|
)
|
|
|
|
type KeeperTestSuite struct {
|
|
suite.Suite
|
|
integrationTest.TestFixture
|
|
|
|
queryClient types.QueryClient
|
|
|
|
accounts []sdk.AccAddress
|
|
bond bondTypes.Bond
|
|
}
|
|
|
|
func (kts *KeeperTestSuite) SetupTest() {
|
|
err := kts.TestFixture.Setup()
|
|
assert.Nil(kts.T(), err)
|
|
|
|
// set default params
|
|
err = kts.RegistryKeeper.Params.Set(kts.SdkCtx, types.DefaultParams())
|
|
assert.Nil(kts.T(), err)
|
|
|
|
qr := kts.App.QueryHelper()
|
|
kts.queryClient = types.NewQueryClient(qr)
|
|
|
|
// Create a bond
|
|
bond, err := kts.createBond()
|
|
assert.Nil(kts.T(), err)
|
|
kts.bond = *bond
|
|
}
|
|
|
|
func TestRegistryKeeperTestSuite(t *testing.T) {
|
|
suite.Run(t, new(KeeperTestSuite))
|
|
}
|
|
|
|
func (kts *KeeperTestSuite) createBond() (*bondTypes.Bond, error) {
|
|
ctx := kts.SdkCtx
|
|
|
|
// Create a funded account
|
|
kts.accounts = simtestutil.AddTestAddrs(kts.BankKeeper, integrationTest.BondDenomProvider{}, ctx, 1, math.NewInt(100000000000))
|
|
|
|
bond, err := kts.BondKeeper.CreateBond(ctx, kts.accounts[0], sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, math.NewInt(1000000000))))
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return bond, nil
|
|
}
|