Skip to content

Commit

Permalink
add params test
Browse files Browse the repository at this point in the history
  • Loading branch information
beer-1 committed Nov 17, 2023
1 parent 7f01974 commit 67aae27
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions x/gov/types/params_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ func Test_Params(t *testing.T) {

params.EmergencyMinDeposit = _emergencyMinDeposit

_emergencyTallyInterval := params.EmergencyTallyInterval
params.EmergencyTallyInterval = 0
require.Error(t, params.ValidateBasic())

params.EmergencyTallyInterval = _emergencyTallyInterval

_minDeposit := params.MinDeposit
params.MinDeposit = []sdk.Coin{{
Denom: "foo",
Expand All @@ -38,26 +44,42 @@ func Test_Params(t *testing.T) {
params.MaxDepositPeriod = _maxDepositPeriod

_minInitialDepositRatio := params.MinInitialDepositRatio
params.MinInitialDepositRatio = "a"
require.Error(t, params.ValidateBasic())
params.MinInitialDepositRatio = "-1"
require.Error(t, params.ValidateBasic())
params.MinInitialDepositRatio = "1.1"
require.Error(t, params.ValidateBasic())

params.MinInitialDepositRatio = _minInitialDepositRatio

_quorum := params.Quorum
params.Quorum = "a"
require.Error(t, params.ValidateBasic())
params.Quorum = "-1"
require.Error(t, params.ValidateBasic())
params.Quorum = "1.1"
require.Error(t, params.ValidateBasic())

params.Quorum = _quorum

_threshold := params.Threshold
params.Threshold = "a"
require.Error(t, params.ValidateBasic())
params.Threshold = "-1"
require.Error(t, params.ValidateBasic())
params.Threshold = "1.1"
require.Error(t, params.ValidateBasic())

params.Threshold = _threshold

_vetoThreshold := params.VetoThreshold
params.VetoThreshold = "a"
require.Error(t, params.ValidateBasic())
params.VetoThreshold = "-1"
require.Error(t, params.ValidateBasic())
params.VetoThreshold = "1.1"
require.Error(t, params.ValidateBasic())

params.VetoThreshold = _vetoThreshold

Expand Down

0 comments on commit 67aae27

Please sign in to comment.