Skip to content

Commit

Permalink
fix TestValidateControllerMetadata' (#7773)
Browse files Browse the repository at this point in the history
Co-authored-by: Gjermund Garaba <[email protected]>
  • Loading branch information
meoaka3 and gjermundgaraba authored Dec 20, 2024
1 parent ed43b48 commit 6201c79
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions modules/apps/27-interchain-accounts/types/metadata_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand Down Expand Up @@ -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",
Expand All @@ -161,7 +162,7 @@ func (suite *TypesTestSuite) TestValidateControllerMetadata() {
TxType: types.TxTypeSDKMultiMsg,
}
},
true,
nil,
},
{
"success with EncodingProto3JSON",
Expand All @@ -175,7 +176,7 @@ func (suite *TypesTestSuite) TestValidateControllerMetadata() {
TxType: types.TxTypeSDKMultiMsg,
}
},
true,
nil,
},
{
"unsupported encoding format",
Expand All @@ -189,7 +190,7 @@ func (suite *TypesTestSuite) TestValidateControllerMetadata() {
TxType: types.TxTypeSDKMultiMsg,
}
},
false,
types.ErrInvalidCodec,
},
{
"unsupported transaction type",
Expand All @@ -203,7 +204,7 @@ func (suite *TypesTestSuite) TestValidateControllerMetadata() {
TxType: "invalid-tx-type",
}
},
false,
types.ErrUnknownDataType,
},
{
"invalid controller connection",
Expand All @@ -217,7 +218,7 @@ func (suite *TypesTestSuite) TestValidateControllerMetadata() {
TxType: types.TxTypeSDKMultiMsg,
}
},
false,
connectiontypes.ErrInvalidConnection,
},
{
"invalid host connection",
Expand All @@ -231,7 +232,7 @@ func (suite *TypesTestSuite) TestValidateControllerMetadata() {
TxType: types.TxTypeSDKMultiMsg,
}
},
false,
connectiontypes.ErrInvalidConnection,
},
{
"invalid address",
Expand All @@ -245,7 +246,7 @@ func (suite *TypesTestSuite) TestValidateControllerMetadata() {
TxType: types.TxTypeSDKMultiMsg,
}
},
false,
types.ErrInvalidAccountAddress,
},
{
"invalid version",
Expand All @@ -259,7 +260,7 @@ func (suite *TypesTestSuite) TestValidateControllerMetadata() {
TxType: types.TxTypeSDKMultiMsg,
}
},
false,
types.ErrInvalidVersion,
},
}

Expand All @@ -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)
}
})
}
Expand Down

0 comments on commit 6201c79

Please sign in to comment.