Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
shaspitz committed Sep 11, 2023
1 parent 129f959 commit ed4cde0
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 14 deletions.
14 changes: 0 additions & 14 deletions x/ccv/provider/proposal_handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,20 +73,6 @@ func TestProviderProposalHandler(t *testing.T) {
blockTime: hourFromNow,
expValidEquivocation: true,
},
{
name: "invalid change reward denoms proposal, none to add or remove",
content: providertypes.NewChangeRewardDenomsProposal(
"title", "description", []string{}, []string{}),
blockTime: hourFromNow,
expValidChangeRewardDenom: false,
},
{
name: "invalid change reward denoms proposal, same denom in both sets",
content: providertypes.NewChangeRewardDenomsProposal(
"title", "description", []string{"denom1"}, []string{"denom1"}),
blockTime: hourFromNow,
expValidChangeRewardDenom: false,
},
{
name: "valid change reward denoms proposal",
content: providertypes.NewChangeRewardDenomsProposal(
Expand Down
35 changes: 35 additions & 0 deletions x/ccv/provider/types/proposal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -362,3 +362,38 @@ func TestEquivocationProposalValidateBasic(t *testing.T) {
})
}
}

func TestChangeRewardDenomsProposalValidateBasic(t *testing.T) {
tcs := []struct {
name string
proposal govv1beta1.Content
expectError bool
}{{

Check failure on line 371 in x/ccv/provider/types/proposal_test.go

View workflow job for this annotation

GitHub Actions / lint

File is not `gofumpt`-ed with `-extra` (gofumpt)
name: "invalid change reward denoms proposal, none to add or remove",
proposal: types.NewChangeRewardDenomsProposal(
"title", "description", []string{}, []string{}),
expectError: true,
}, {
name: "invalid change reward denoms proposal, same denom in both sets",
proposal: types.NewChangeRewardDenomsProposal(
"title", "description", []string{"denom1"}, []string{"denom1"}),
expectError: true,
}, {
name: "valid change reward denoms proposal",
proposal: types.NewChangeRewardDenomsProposal(
"title", "description", []string{"denom1"}, []string{"denom2"}),
expectError: false,
},
}

for _, tc := range tcs {
t.Run(tc.name, func(t *testing.T) {
err := tc.proposal.ValidateBasic()
if tc.expectError {
require.Error(t, err)
return
}
require.NoError(t, err)
})
}
}

0 comments on commit ed4cde0

Please sign in to comment.