Skip to content

Commit

Permalink
test for invalid denom
Browse files Browse the repository at this point in the history
  • Loading branch information
shaspitz committed Sep 12, 2023
1 parent 0a81ab2 commit 93b68a9
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions x/ccv/provider/types/proposal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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)
Expand Down

0 comments on commit 93b68a9

Please sign in to comment.