Skip to content

Commit

Permalink
add FungibleTokenPacketDataV2 test for ValidateBasic (#6398)
Browse files Browse the repository at this point in the history
  • Loading branch information
hastur199 authored May 28, 2024
1 parent 7cd7260 commit 6673e74
Showing 1 changed file with 50 additions and 0 deletions.
50 changes: 50 additions & 0 deletions modules/apps/transfer/types/packet_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,31 @@ func TestFungibleTokenPacketDataV2ValidateBasic(t *testing.T) {
),
nil,
},
{
"success: valid packet with forwarding path hops",
types.NewFungibleTokenPacketDataV2(
[]types.Token{
{
Denom: denom,
Amount: amount,
Trace: []string{"transfer/channel-0", "transfer/channel-1"},
},
},
sender,
receiver,
"",
&types.ForwardingInfo{
Hops: []*types.Hop{
{
PortId: "transfer",
ChannelId: "channel-1",
},
},
Memo: "",
},
),
nil,
},
{
"failure: invalid denom",
types.NewFungibleTokenPacketDataV2(
Expand Down Expand Up @@ -367,6 +392,31 @@ func TestFungibleTokenPacketDataV2ValidateBasic(t *testing.T) {
),
types.ErrInvalidMemo,
},
{
"failure: memo must be empty if forwarding path hops is not empty",
types.NewFungibleTokenPacketDataV2(
[]types.Token{
{
Denom: denom,
Amount: amount,
Trace: []string{"transfer/channel-0", "transfer/channel-1"},
},
},
sender,
receiver,
"memo",
&types.ForwardingInfo{
Hops: []*types.Hop{
{
PortId: "transfer",
ChannelId: "channel-1",
},
},
Memo: "",
},
),
types.ErrInvalidMemo,
},
}

for _, tc := range testCases {
Expand Down

0 comments on commit 6673e74

Please sign in to comment.