From 93b68a95d75829dd0392d9343638d718747ade7e Mon Sep 17 00:00:00 2001 From: Shawn <44221603+smarshall-spitzbart@users.noreply.github.com> Date: Tue, 12 Sep 2023 09:23:56 -0700 Subject: [PATCH] test for invalid denom --- x/ccv/provider/types/proposal_test.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/x/ccv/provider/types/proposal_test.go b/x/ccv/provider/types/proposal_test.go index 3b661981a1..612408a0a3 100644 --- a/x/ccv/provider/types/proposal_test.go +++ b/x/ccv/provider/types/proposal_test.go @@ -368,6 +368,7 @@ func TestChangeRewardDenomsProposalValidateBasic(t *testing.T) { name string proposal govv1beta1.Content expectError bool + expectPanic bool }{ { name: "invalid change reward denoms proposal, none to add or remove", @@ -385,10 +386,20 @@ func TestChangeRewardDenomsProposalValidateBasic(t *testing.T) { "title", "description", []string{"denom1"}, []string{"denom2"}), expectError: false, }, + { + name: "invalid prop, invalid denom, will panic", + proposal: types.NewChangeRewardDenomsProposal( + "title", "description", []string{"!@blah"}, []string{"denom2"}), + expectPanic: true, + }, } for _, tc := range tcs { t.Run(tc.name, func(t *testing.T) { + if tc.expectPanic { + require.Panics(t, func() { tc.proposal.ValidateBasic() }) + return + } err := tc.proposal.ValidateBasic() if tc.expectError { require.Error(t, err)