-
Notifications
You must be signed in to change notification settings - Fork 122
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* changes * Update shared_params.go * Create params_test.go * corrections * remove println * Update x/ccv/consumer/types/params_test.go Co-authored-by: Simon Noetzlin <[email protected]> * Update x/ccv/consumer/types/params_test.go Co-authored-by: Simon Noetzlin <[email protected]> * fixing TestValidateParams Co-authored-by: Marius Poke <[email protected]> Co-authored-by: Simon Noetzlin <[email protected]>
- Loading branch information
1 parent
e5f4ea5
commit 27e55b4
Showing
8 changed files
with
159 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package types_test | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/stretchr/testify/require" | ||
|
||
consumertypes "github.com/cosmos/interchain-security/x/ccv/consumer/types" | ||
) | ||
|
||
// Tests the validation of consumer params that happens at genesis | ||
func TestValidateParams(t *testing.T) { | ||
|
||
testCases := []struct { | ||
name string | ||
params consumertypes.Params | ||
expPass bool | ||
}{ | ||
{"default params", consumertypes.DefaultParams(), true}, | ||
{"custom valid params", consumertypes.NewParams(true, 5, "", "", 5), true}, | ||
{"custom invalid params, block per dist transmission", consumertypes.NewParams(true, -5, "", "", 5), false}, | ||
{"custom invalid params, dist transmission channel", consumertypes.NewParams(true, 5, "badchannel/", "", 5), false}, | ||
{"custom invalid params, provider fee pool addr string", consumertypes.NewParams(true, 5, "", "imabadaddress", 5), false}, | ||
{"custom invalid params, ccv timeout", consumertypes.NewParams(true, 5, "", "", -5), false}, | ||
} | ||
|
||
for _, tc := range testCases { | ||
err := tc.params.Validate() | ||
if tc.expPass { | ||
require.Nil(t, err, "expected error to be nil for test case: %s", tc.name) | ||
} else { | ||
require.NotNil(t, err, "expected error but got nil for test case: %s", tc.name) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters