Skip to content

Commit

Permalink
Add test case for multiple hos
Browse files Browse the repository at this point in the history
  • Loading branch information
bznein committed Jun 25, 2024
1 parent 1c0fb6c commit 0e67b51
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions modules/apps/transfer/keeper/msg_server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,26 @@ func (suite *KeeperTestSuite) TestUnwindHops() {
suite.Require().Equal(*msg, *modified, "expected msg and modified msg are different")
},
},
{
"success: multiple unwind hops",
func() {
denom.Trace = append(denom.Trace, types.NewTrace(ibctesting.MockPort, "channel-2"), types.NewTrace(ibctesting.MockPort, "channel-3"))
coins = sdk.NewCoins(sdk.NewCoin(denom.IBCDenom(), ibctesting.TestCoin.Amount))
suite.chainA.GetSimApp().TransferKeeper.SetDenom(suite.chainA.GetContext(), denom)
msg.Tokens = coins
},
func(modified *types.MsgTransfer, err error) {
suite.Require().NoError(err, "got unexpected error from unwindHops")
msg.SourceChannel = denom.Trace[0].PortId
msg.SourcePort = denom.Trace[0].ChannelId
msg.Forwarding = types.NewForwarding(false,
types.Hop{PortId: denom.Trace[3].PortId, ChannelId: denom.Trace[3].ChannelId},
types.Hop{PortId: denom.Trace[2].PortId, ChannelId: denom.Trace[2].ChannelId},
types.Hop{PortId: denom.Trace[1].PortId, ChannelId: denom.Trace[1].ChannelId},
)
suite.Require().Equal(*msg, *modified, "expected msg and modified msg are different")
},
},
{
"success - unwind hops are added to existing hops",
func() {
Expand Down

0 comments on commit 0e67b51

Please sign in to comment.