Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
mmsqe committed Oct 13, 2023
1 parent 773bde0 commit 43b2ca5
Showing 1 changed file with 2 additions and 16 deletions.
18 changes: 2 additions & 16 deletions x/bank/migrations/v4/store_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,11 @@ import (
sdk "github.com/cosmos/cosmos-sdk/types"
moduletestutil "github.com/cosmos/cosmos-sdk/types/module/testutil"
"github.com/cosmos/cosmos-sdk/x/bank"
"github.com/cosmos/cosmos-sdk/x/bank/exported"
v4 "github.com/cosmos/cosmos-sdk/x/bank/migrations/v4"
"github.com/cosmos/cosmos-sdk/x/bank/types"
"github.com/stretchr/testify/require"
)

type mockSubspace struct {
ps types.Params
}

func newMockSubspace(ps types.Params) mockSubspace {
return mockSubspace{ps: ps}
}

func (ms mockSubspace) GetParamSet(ctx sdk.Context, ps exported.ParamSet) {
*ps.(*types.Params) = ms.ps
}

func TestMigrate(t *testing.T) {
encCfg := moduletestutil.MakeTestEncodingConfig(bank.AppModuleBasic{})
cdc := encCfg.Codec
Expand All @@ -34,11 +21,10 @@ func TestMigrate(t *testing.T) {
ctx := testutil.DefaultContext(storeKey, tKey)
store := ctx.KVStore(storeKey)

legacySubspace := newMockSubspace(types.DefaultParams())
require.NoError(t, v4.MigrateStore(ctx, storeKey, legacySubspace, cdc))
require.NoError(t, v4.MigrateStore(ctx, storeKey, types.DefaultParams(), cdc))

var res types.Params
bz := store.Get(v4.ParamsKey)
require.NoError(t, cdc.Unmarshal(bz, &res))
require.Equal(t, legacySubspace.ps, res)
require.Equal(t, types.DefaultParams(), res)
}

0 comments on commit 43b2ca5

Please sign in to comment.