From 5bd6eda2b020d9f136b986d4d3e15b013d275463 Mon Sep 17 00:00:00 2001 From: meoaka3 Date: Fri, 20 Dec 2024 00:55:06 +0700 Subject: [PATCH] fix test TestValidateControllerGenesisState (#7753) Co-authored-by: Damian Nolan --- .../genesis/types/genesis_test.go | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/modules/apps/27-interchain-accounts/genesis/types/genesis_test.go b/modules/apps/27-interchain-accounts/genesis/types/genesis_test.go index da06cd44b12..6fddd5c8a1b 100644 --- a/modules/apps/27-interchain-accounts/genesis/types/genesis_test.go +++ b/modules/apps/27-interchain-accounts/genesis/types/genesis_test.go @@ -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", @@ -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", @@ -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", @@ -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", @@ -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", @@ -187,7 +187,7 @@ func (suite *GenesisTypesTestSuite) TestValidateControllerGenesisState() { genesisState = genesistypes.NewControllerGenesisState(activeChannels, registeredAccounts, []string{"invalid|port"}, controllertypes.DefaultParams()) }, - false, + host.ErrInvalidID, }, } @@ -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) } }) }