Skip to content

Commit

Permalink
fix TestValidateHostGenesisState"
Browse files Browse the repository at this point in the history
  • Loading branch information
meoaka3 committed Dec 20, 2024
1 parent c41f3ef commit 0f80c15
Showing 1 changed file with 9 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -217,12 +217,12 @@ func (suite *GenesisTypesTestSuite) TestValidateHostGenesisState() {
testCases := []struct {
name string
malleate func()
expPass bool
expErr error
}{
{
"success",
func() {},
true,
nil,
},
{
"failed to validate active channel - invalid port identifier",
Expand All @@ -236,7 +236,7 @@ func (suite *GenesisTypesTestSuite) TestValidateHostGenesisState() {

genesisState = genesistypes.NewHostGenesisState(activeChannels, []genesistypes.RegisteredInterchainAccount{}, icatypes.HostPortID, hosttypes.DefaultParams())
},
false,
host.ErrInvalidID,
},
{
"failed to validate active channel - invalid channel identifier",
Expand All @@ -250,7 +250,7 @@ func (suite *GenesisTypesTestSuite) TestValidateHostGenesisState() {

genesisState = genesistypes.NewHostGenesisState(activeChannels, []genesistypes.RegisteredInterchainAccount{}, icatypes.HostPortID, hosttypes.DefaultParams())
},
false,
host.ErrInvalidID,
},
{
"failed to validate registered account - invalid port identifier",
Expand All @@ -271,7 +271,7 @@ func (suite *GenesisTypesTestSuite) TestValidateHostGenesisState() {

genesisState = genesistypes.NewHostGenesisState(activeChannels, registeredAccounts, icatypes.HostPortID, hosttypes.DefaultParams())
},
false,
host.ErrInvalidID,
},
{
"failed to validate registered account - invalid owner address",
Expand All @@ -292,7 +292,7 @@ func (suite *GenesisTypesTestSuite) TestValidateHostGenesisState() {

genesisState = genesistypes.NewHostGenesisState(activeChannels, registeredAccounts, icatypes.HostPortID, hosttypes.DefaultParams())
},
false,
icatypes.ErrInvalidAccountAddress,
},
{
"failed to validate controller ports - invalid port identifier",
Expand All @@ -313,7 +313,7 @@ func (suite *GenesisTypesTestSuite) TestValidateHostGenesisState() {

genesisState = genesistypes.NewHostGenesisState(activeChannels, registeredAccounts, "invalid|port", hosttypes.DefaultParams())
},
false,
host.ErrInvalidID,
},
}

Expand All @@ -327,10 +327,11 @@ func (suite *GenesisTypesTestSuite) TestValidateHostGenesisState() {

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 0f80c15

Please sign in to comment.