Skip to content

Commit

Permalink
test(x/gov): add case test for MsgVoteWeighted (#19403)
Browse files Browse the repository at this point in the history
  • Loading branch information
zoereco authored Feb 13, 2024
1 parent c57dde2 commit 3461c64
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion x/gov/keeper/msg_server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
},
Expand Down

0 comments on commit 3461c64

Please sign in to comment.