From 6201c799da3926c66cc8b8acbae220efd4a95603 Mon Sep 17 00:00:00 2001 From: meoaka3 Date: Sat, 21 Dec 2024 01:24:28 +0700 Subject: [PATCH] fix TestValidateControllerMetadata' (#7773) Co-authored-by: Gjermund Garaba --- .../types/metadata_test.go | 24 ++++++++++--------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/modules/apps/27-interchain-accounts/types/metadata_test.go b/modules/apps/27-interchain-accounts/types/metadata_test.go index b408f98b0fc..4b6e0810c05 100644 --- a/modules/apps/27-interchain-accounts/types/metadata_test.go +++ b/modules/apps/27-interchain-accounts/types/metadata_test.go @@ -2,6 +2,7 @@ package types_test import ( "github.com/cosmos/ibc-go/v9/modules/apps/27-interchain-accounts/types" + connectiontypes "github.com/cosmos/ibc-go/v9/modules/core/03-connection/types" ibctesting "github.com/cosmos/ibc-go/v9/testing" ) @@ -142,12 +143,12 @@ func (suite *TypesTestSuite) TestValidateControllerMetadata() { testCases := []struct { name string malleate func() - expPass bool + expErr error }{ { "success", func() {}, - true, + nil, }, { "success with empty account address", @@ -161,7 +162,7 @@ func (suite *TypesTestSuite) TestValidateControllerMetadata() { TxType: types.TxTypeSDKMultiMsg, } }, - true, + nil, }, { "success with EncodingProto3JSON", @@ -175,7 +176,7 @@ func (suite *TypesTestSuite) TestValidateControllerMetadata() { TxType: types.TxTypeSDKMultiMsg, } }, - true, + nil, }, { "unsupported encoding format", @@ -189,7 +190,7 @@ func (suite *TypesTestSuite) TestValidateControllerMetadata() { TxType: types.TxTypeSDKMultiMsg, } }, - false, + types.ErrInvalidCodec, }, { "unsupported transaction type", @@ -203,7 +204,7 @@ func (suite *TypesTestSuite) TestValidateControllerMetadata() { TxType: "invalid-tx-type", } }, - false, + types.ErrUnknownDataType, }, { "invalid controller connection", @@ -217,7 +218,7 @@ func (suite *TypesTestSuite) TestValidateControllerMetadata() { TxType: types.TxTypeSDKMultiMsg, } }, - false, + connectiontypes.ErrInvalidConnection, }, { "invalid host connection", @@ -231,7 +232,7 @@ func (suite *TypesTestSuite) TestValidateControllerMetadata() { TxType: types.TxTypeSDKMultiMsg, } }, - false, + connectiontypes.ErrInvalidConnection, }, { "invalid address", @@ -245,7 +246,7 @@ func (suite *TypesTestSuite) TestValidateControllerMetadata() { TxType: types.TxTypeSDKMultiMsg, } }, - false, + types.ErrInvalidAccountAddress, }, { "invalid version", @@ -259,7 +260,7 @@ func (suite *TypesTestSuite) TestValidateControllerMetadata() { TxType: types.TxTypeSDKMultiMsg, } }, - false, + types.ErrInvalidVersion, }, } @@ -282,10 +283,11 @@ func (suite *TypesTestSuite) TestValidateControllerMetadata() { metadata, ) - 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) } }) }