Skip to content

Commit

Permalink
test: fix failing test on empty packet payload
Browse files Browse the repository at this point in the history
  • Loading branch information
jtieri committed Sep 28, 2023
1 parent 8377ef4 commit 0a410a3
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions middleware/packet-forward-middleware/router/module_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,13 +122,19 @@ func TestOnRecvPacket_EmptyPacket(t *testing.T) {
senderAccAddr := test.AccAddress()
packet := emptyPacket()

// Expected mocks
gomock.InOrder(
setup.Mocks.IBCModuleMock.EXPECT().OnRecvPacket(ctx, packet, senderAccAddr).
Return(channeltypes.NewResultAcknowledgement([]byte(""))),
)

ack := forwardMiddleware.OnRecvPacket(ctx, packet, senderAccAddr)
require.False(t, ack.Success())
require.True(t, ack.Success())

expectedAck := &channeltypes.Acknowledgement{}
err := cdc.UnmarshalJSON(ack.Acknowledgement(), expectedAck)
require.NoError(t, err)
require.Equal(t, "packet-forward-middleware error: failed to unmarshal packet data as FungibleTokenPacketData: EOF", expectedAck.GetError())
require.Equal(t, "", expectedAck.GetError())
}

func TestOnRecvPacket_InvalidReceiver(t *testing.T) {
Expand Down

0 comments on commit 0a410a3

Please sign in to comment.