From 719bbaf310e0ed115f1940dd39f906108cff66c5 Mon Sep 17 00:00:00 2001 From: Noulodado Date: Fri, 20 Dec 2024 23:48:08 +0200 Subject: [PATCH] fix to use expected error (#7778) Co-authored-by: Gjermund Garaba --- .../types/metadata_test.go | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/modules/apps/27-interchain-accounts/types/metadata_test.go b/modules/apps/27-interchain-accounts/types/metadata_test.go index 4b6e0810c05..f96174c04d0 100644 --- a/modules/apps/27-interchain-accounts/types/metadata_test.go +++ b/modules/apps/27-interchain-accounts/types/metadata_test.go @@ -299,12 +299,12 @@ func (suite *TypesTestSuite) TestValidateHostMetadata() { testCases := []struct { name string malleate func() - expPass bool + expError error }{ { "success", func() {}, - true, + nil, }, { "success with empty account address", @@ -318,7 +318,7 @@ func (suite *TypesTestSuite) TestValidateHostMetadata() { TxType: types.TxTypeSDKMultiMsg, } }, - true, + nil, }, { "success with EncodingProto3JSON", @@ -332,7 +332,7 @@ func (suite *TypesTestSuite) TestValidateHostMetadata() { TxType: types.TxTypeSDKMultiMsg, } }, - true, + nil, }, { "unsupported encoding format", @@ -346,7 +346,7 @@ func (suite *TypesTestSuite) TestValidateHostMetadata() { TxType: types.TxTypeSDKMultiMsg, } }, - false, + types.ErrInvalidCodec, }, { "unsupported transaction type", @@ -360,7 +360,7 @@ func (suite *TypesTestSuite) TestValidateHostMetadata() { TxType: "invalid-tx-type", } }, - false, + types.ErrUnknownDataType, }, { "invalid controller connection", @@ -374,7 +374,7 @@ func (suite *TypesTestSuite) TestValidateHostMetadata() { TxType: types.TxTypeSDKMultiMsg, } }, - false, + connectiontypes.ErrInvalidConnection, }, { "invalid host connection", @@ -388,7 +388,7 @@ func (suite *TypesTestSuite) TestValidateHostMetadata() { TxType: types.TxTypeSDKMultiMsg, } }, - false, + connectiontypes.ErrInvalidConnection, }, { "invalid address", @@ -402,7 +402,7 @@ func (suite *TypesTestSuite) TestValidateHostMetadata() { TxType: types.TxTypeSDKMultiMsg, } }, - false, + types.ErrInvalidAccountAddress, }, { "invalid version", @@ -416,7 +416,7 @@ func (suite *TypesTestSuite) TestValidateHostMetadata() { TxType: types.TxTypeSDKMultiMsg, } }, - false, + types.ErrInvalidVersion, }, } @@ -439,10 +439,10 @@ func (suite *TypesTestSuite) TestValidateHostMetadata() { metadata, ) - if tc.expPass { + if tc.expError == nil { suite.Require().NoError(err, tc.name) } else { - suite.Require().Error(err, tc.name) + suite.Require().ErrorIs(err, tc.expError) } }) }