Skip to content

Commit

Permalink
Merge PR cosmos#6693: x/staking/simulation/params.go: add unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dauTT authored Jul 12, 2020
1 parent d6e0888 commit 2de851d
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions x/staking/simulation/params_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package simulation_test

import (
"math/rand"
"testing"

"github.com/stretchr/testify/require"

"github.com/cosmos/cosmos-sdk/x/staking/simulation"
)

func TestParamChanges(t *testing.T) {
s := rand.NewSource(1)
r := rand.New(s)

expected := []struct {
composedKey string
key string
simValue string
subspace string
}{
{"staking/MaxValidators", "MaxValidators", "82", "staking"},
{"staking/UnbondingTime", "UnbondingTime", "\"275307000000000\"", "staking"},
{"staking/HistoricalEntries", "HistoricalEntries", "29", "staking"},
}

paramChanges := simulation.ParamChanges(r)

require.Len(t, paramChanges, 3)

for i, p := range paramChanges {
require.Equal(t, expected[i].composedKey, p.ComposedKey())
require.Equal(t, expected[i].key, p.Key())
require.Equal(t, expected[i].simValue, p.SimValue()(r))
require.Equal(t, expected[i].subspace, p.Subspace())
}
}

0 comments on commit 2de851d

Please sign in to comment.