laconicd-deprecated/x/feemarket/keeper/migrations_test.go
2023-03-13 12:34:10 +05:30

42 lines
921 B
Go

package keeper_test
import (
feemarketkeeper "github.com/cerc-io/laconicd/x/feemarket/keeper"
"github.com/cerc-io/laconicd/x/feemarket/types"
sdk "github.com/cosmos/cosmos-sdk/types"
)
type mockSubspace struct {
ps types.Params
}
func newMockSubspace(ps types.Params) mockSubspace {
return mockSubspace{ps: ps}
}
func (ms mockSubspace) GetParamSetIfExists(_ sdk.Context, ps types.LegacyParams) {
*ps.(*types.Params) = ms.ps
}
func (suite *KeeperTestSuite) TestMigrations() {
legacySubspace := newMockSubspace(types.DefaultParams())
migrator := feemarketkeeper.NewMigrator(suite.app.FeeMarketKeeper, legacySubspace)
testCases := []struct {
name string
migrateFunc func(ctx sdk.Context) error
}{
{
"Run Migrate3to4",
migrator.Migrate3to4,
},
}
for _, tc := range testCases {
suite.Run(tc.name, func() {
err := tc.migrateFunc(suite.ctx)
suite.Require().NoError(err)
})
}
}