Skip to content
This repository has been archived by the owner on Apr 4, 2024. It is now read-only.

Commit

Permalink
tests
Browse files Browse the repository at this point in the history
  • Loading branch information
fedekunze committed Jun 5, 2022
1 parent 63efb44 commit 9814c7c
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions x/feemarket/migrations/v011/migrate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,15 @@ import (
"github.com/tharsis/ethermint/app"
v010types "github.com/tharsis/ethermint/x/feemarket/migrations/v010/types"
v011 "github.com/tharsis/ethermint/x/feemarket/migrations/v011"
"github.com/tharsis/ethermint/x/feemarket/types"
feemarkettypes "github.com/tharsis/ethermint/x/feemarket/types"
)

func init() {
// modify defaults through global
types.DefaultMinGasPrice = sdk.NewDecWithPrec(25, 3)
}

func TestMigrateStore(t *testing.T) {
encCfg := encoding.MakeConfig(app.ModuleBasics)
feemarketKey := sdk.NewKVStoreKey(feemarkettypes.StoreKey)
Expand All @@ -42,8 +48,10 @@ func TestMigrateStore(t *testing.T) {
require.True(t, paramstore.Has(ctx, feemarkettypes.ParamStoreKeyMinGasPrice))
require.True(t, paramstore.Has(ctx, feemarkettypes.ParamStoreKeyMinGasMultiplier))

var minGasPrice sdk.Dec
var minGasMultiplier sdk.Dec
var (
minGasPrice sdk.Dec
minGasMultiplier sdk.Dec
)

// Make sure the new params are set
require.NotPanics(t, func() {
Expand All @@ -52,7 +60,9 @@ func TestMigrateStore(t *testing.T) {
})

// check the params are updated
require.True(t, minGasPrice.IsZero())
require.Equal(t, types.DefaultMinGasPrice.String(), minGasPrice.String())
require.False(t, minGasPrice.IsZero())
require.Equal(t, types.DefaultMinGasMultiplier.String(), minGasMultiplier.String())
}

func TestMigrateJSON(t *testing.T) {
Expand All @@ -73,5 +83,6 @@ func TestMigrateJSON(t *testing.T) {

migratedGenState := v011.MigrateJSON(genState)

require.True(t, migratedGenState.Params.MinGasPrice.IsZero())
require.Equal(t, types.DefaultMinGasPrice, migratedGenState.Params.MinGasPrice)
require.Equal(t, types.DefaultMinGasMultiplier, migratedGenState.Params.MinGasMultiplier)
}

0 comments on commit 9814c7c

Please sign in to comment.