From 3461c64afb8df4949eb87ea3abdd4e568fdcabb3 Mon Sep 17 00:00:00 2001 From: zoereco <158379334+zoereco@users.noreply.github.com> Date: Tue, 13 Feb 2024 16:07:36 +0100 Subject: [PATCH] test(x/gov): add case test for MsgVoteWeighted (#19403) --- x/gov/keeper/msg_server_test.go | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/x/gov/keeper/msg_server_test.go b/x/gov/keeper/msg_server_test.go index 87d7c118c947..5163353a069d 100644 --- a/x/gov/keeper/msg_server_test.go +++ b/x/gov/keeper/msg_server_test.go @@ -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 },