43 lines
968 B
Go
43 lines
968 B
Go
|
package keeper_test
|
||
|
|
||
|
import (
|
||
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
||
|
evmkeeper "github.com/evmos/ethermint/x/evm/keeper"
|
||
|
v4types "github.com/evmos/ethermint/x/evm/migrations/v4/types"
|
||
|
"github.com/evmos/ethermint/x/evm/types"
|
||
|
)
|
||
|
|
||
|
type mockSubspace struct {
|
||
|
ps v4types.V4Params
|
||
|
}
|
||
|
|
||
|
func newMockSubspace(ps v4types.V4Params) mockSubspace {
|
||
|
return mockSubspace{ps: ps}
|
||
|
}
|
||
|
|
||
|
func (ms mockSubspace) GetParamSetIfExists(_ sdk.Context, ps types.LegacyParams) {
|
||
|
*ps.(*v4types.V4Params) = ms.ps
|
||
|
}
|
||
|
|
||
|
func (suite *KeeperTestSuite) TestMigrations() {
|
||
|
legacySubspace := newMockSubspace(v4types.DefaultParams())
|
||
|
migrator := evmkeeper.NewMigrator(*suite.app.EvmKeeper, 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)
|
||
|
})
|
||
|
}
|
||
|
}
|