test(x/gov): add case test for MsgVoteWeighted (#19403)

This commit is contained in:
zoereco
2024-02-13 15:07:36 +00:00
committed by GitHub
parent c57dde2f34
commit 3461c64afb
+14 -1
View File
@@ -740,6 +740,19 @@ func (suite *KeeperTestSuite) TestMsgVoteWeighted() {
expErr: true,
expErrMsg: `option:VOTE_OPTION_ONE weight:"-1.000000000000000000" : invalid vote option`,
},
"individual weight > 1 but weights sum == 1": {
preRun: func() uint64 {
return proposalID
},
option: v1.WeightedVoteOptions{
v1.NewWeightedVoteOption(v1.OptionYes, sdkmath.LegacyNewDec(2)),
v1.NewWeightedVoteOption(v1.OptionNo, sdkmath.LegacyNewDec(-1)),
},
voter: proposer,
metadata: "",
expErr: true,
expErrMsg: `option:VOTE_OPTION_ONE weight:"2.000000000000000000" : invalid vote option`,
},
"empty options": {
preRun: func() uint64 {
return proposalID
@@ -784,7 +797,7 @@ func (suite *KeeperTestSuite) TestMsgVoteWeighted() {
expErr: true,
expErrMsg: "optimistic proposals can only be rejected: invalid vote option",
},
"weight sum < 1": {
"weights sum < 1": {
preRun: func() uint64 {
return proposalID
},