Skip to content

Commit

Permalink
fix test TestValidateControllerGenesisState (#7753)
Browse files Browse the repository at this point in the history
Co-authored-by: Damian Nolan <[email protected]>
  • Loading branch information
meoaka3 and damiannolan authored Dec 19, 2024
1 parent 8164b07 commit 5bd6eda
Showing 1 changed file with 9 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,12 @@ func (suite *GenesisTypesTestSuite) TestValidateControllerGenesisState() {
testCases := []struct {
name string
malleate func()
expPass bool
expErr error
}{
{
"success",
func() {},
true,
nil,
},
{
"failed to validate active channel - invalid port identifier",
Expand All @@ -110,7 +110,7 @@ func (suite *GenesisTypesTestSuite) TestValidateControllerGenesisState() {

genesisState = genesistypes.NewControllerGenesisState(activeChannels, []genesistypes.RegisteredInterchainAccount{}, []string{}, controllertypes.DefaultParams())
},
false,
host.ErrInvalidID,
},
{
"failed to validate active channel - invalid channel identifier",
Expand All @@ -124,7 +124,7 @@ func (suite *GenesisTypesTestSuite) TestValidateControllerGenesisState() {

genesisState = genesistypes.NewControllerGenesisState(activeChannels, []genesistypes.RegisteredInterchainAccount{}, []string{}, controllertypes.DefaultParams())
},
false,
host.ErrInvalidID,
},
{
"failed to validate registered account - invalid port identifier",
Expand All @@ -145,7 +145,7 @@ func (suite *GenesisTypesTestSuite) TestValidateControllerGenesisState() {

genesisState = genesistypes.NewControllerGenesisState(activeChannels, registeredAccounts, []string{}, controllertypes.DefaultParams())
},
false,
host.ErrInvalidID,
},
{
"failed to validate registered account - invalid owner address",
Expand All @@ -166,7 +166,7 @@ func (suite *GenesisTypesTestSuite) TestValidateControllerGenesisState() {

genesisState = genesistypes.NewControllerGenesisState(activeChannels, registeredAccounts, []string{}, controllertypes.DefaultParams())
},
false,
icatypes.ErrInvalidAccountAddress,
},
{
"failed to validate controller ports - invalid port identifier",
Expand All @@ -187,7 +187,7 @@ func (suite *GenesisTypesTestSuite) TestValidateControllerGenesisState() {

genesisState = genesistypes.NewControllerGenesisState(activeChannels, registeredAccounts, []string{"invalid|port"}, controllertypes.DefaultParams())
},
false,
host.ErrInvalidID,
},
}

Expand All @@ -201,10 +201,11 @@ func (suite *GenesisTypesTestSuite) TestValidateControllerGenesisState() {

err := genesisState.Validate()

if tc.expPass {
if tc.expErr == nil {
suite.Require().NoError(err, tc.name)
} else {
suite.Require().Error(err, tc.name)
suite.Require().ErrorIs(err, tc.expErr)
}
})
}
Expand Down

0 comments on commit 5bd6eda

Please sign in to comment.