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

This commit is contained in:
zoereco 2024-02-13 16:07:36 +01:00 committed by GitHub
parent c57dde2f34
commit 3461c64afb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

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
},