Skip to content

Commit

Permalink
fix TestValidateBasic packet (#7775)
Browse files Browse the repository at this point in the history
Co-authored-by: Gjermund Garaba <gjermund@garaba.net>
  • Loading branch information
essenmeoikia and gjermundgaraba authored Dec 20, 2024
1 parent 6201c79 commit 18162f0
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions modules/apps/27-interchain-accounts/types/packet_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ func (suite *TypesTestSuite) TestValidateBasic() {
testCases := []struct {
name string
packetData types.InterchainAccountPacketData
expPass bool
expErr error
}{
{
"success",
Expand All @@ -20,15 +20,15 @@ func (suite *TypesTestSuite) TestValidateBasic() {
Data: []byte("data"),
Memo: "memo",
},
true,
nil,
},
{
"success, empty memo",
types.InterchainAccountPacketData{
Type: types.EXECUTE_TX,
Data: []byte("data"),
},
true,
nil,
},
{
"type unspecified",
Expand All @@ -37,7 +37,7 @@ func (suite *TypesTestSuite) TestValidateBasic() {
Data: []byte("data"),
Memo: "memo",
},
false,
types.ErrInvalidOutgoingData,
},
{
"empty data",
Expand All @@ -46,7 +46,7 @@ func (suite *TypesTestSuite) TestValidateBasic() {
Data: []byte{},
Memo: "memo",
},
false,
types.ErrInvalidOutgoingData,
},
{
"nil data",
Expand All @@ -55,7 +55,7 @@ func (suite *TypesTestSuite) TestValidateBasic() {
Data: nil,
Memo: "memo",
},
false,
types.ErrInvalidOutgoingData,
},
{
"memo too large",
Expand All @@ -64,7 +64,7 @@ func (suite *TypesTestSuite) TestValidateBasic() {
Data: []byte("data"),
Memo: ibctesting.GenerateString(types.MaxMemoCharLength + 1),
},
false,
types.ErrInvalidOutgoingData,
},
}

Expand All @@ -75,10 +75,11 @@ func (suite *TypesTestSuite) TestValidateBasic() {

err := tc.packetData.ValidateBasic()

if tc.expPass {
if tc.expErr == nil {
suite.Require().NoError(err)
} else {
suite.Require().Error(err)
suite.Require().ErrorIs(err, tc.expErr)
}
})
}
Expand Down

0 comments on commit 18162f0

Please sign in to comment.