Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions x/wasm/ibc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,38 @@ func TestMapToWasmVMIBCPacket(t *testing.T) {
}
}

func TestValidateChannelParams(t *testing.T) {
specs := map[string]struct {
channelID string
expErr bool
}{
"valid zero channel sequence": {
channelID: "channel-0",
},
"valid max uint32 channel sequence": {
channelID: "channel-4294967295",
},
"invalid channel sequence beyond uint32": {
channelID: "channel-4294967296",
expErr: true,
},
"invalid channel ID format": {
channelID: "invalid-channel",
expErr: true,
},
}
for name, spec := range specs {
t.Run(name, func(t *testing.T) {
err := ValidateChannelParams(spec.channelID)
if spec.expErr {
require.Error(t, err)
return
}
require.NoError(t, err)
})
}
}

func IBCPacketFixture(mutators ...func(p *channeltypes.Packet)) channeltypes.Packet {
r := channeltypes.Packet{
Sequence: 1,
Expand Down