@@ -272,7 +272,6 @@ func (s *TypesTestSuite) TestMsgRecvPacketValidateBasic() {
272
272
273
273
func (s * TypesTestSuite ) TestMsgAcknowledge_ValidateBasic () {
274
274
var msg * types.MsgAcknowledgement
275
-
276
275
testCases := []struct {
277
276
name string
278
277
malleate func ()
@@ -326,3 +325,59 @@ func (s *TypesTestSuite) TestMsgAcknowledge_ValidateBasic() {
326
325
})
327
326
}
328
327
}
328
+
329
+ func (s * TypesTestSuite ) TestMsgTimeoutValidateBasic () {
330
+ var msg * types.MsgTimeout
331
+
332
+ testCases := []struct {
333
+ name string
334
+ malleate func ()
335
+ expError error
336
+ }{
337
+ {
338
+ name : "success" ,
339
+ malleate : func () {},
340
+ },
341
+ {
342
+ name : "failure: invalid signer" ,
343
+ malleate : func () {
344
+ msg .Signer = ""
345
+ },
346
+ expError : ibcerrors .ErrInvalidAddress ,
347
+ },
348
+ {
349
+ name : "failure: invalid packet" ,
350
+ malleate : func () {
351
+ msg .Packet .Sequence = 0
352
+ },
353
+ expError : types .ErrInvalidPacket ,
354
+ },
355
+ {
356
+ name : "failure: invalid proof unreceived" ,
357
+ malleate : func () {
358
+ msg .ProofUnreceived = []byte {}
359
+ },
360
+ expError : commitmenttypes .ErrInvalidProof ,
361
+ },
362
+ }
363
+ for _ , tc := range testCases {
364
+ s .Run (tc .name , func () {
365
+ msg = types .NewMsgTimeout (
366
+ types .NewPacket (1 , ibctesting .FirstChannelID , ibctesting .SecondChannelID , s .chainA .GetTimeoutTimestamp (), mockv2 .NewMockPacketData (mockv2 .ModuleNameA , mockv2 .ModuleNameB )),
367
+ testProof ,
368
+ clienttypes .ZeroHeight (),
369
+ s .chainA .SenderAccount .GetAddress ().String (),
370
+ )
371
+
372
+ tc .malleate ()
373
+
374
+ err := msg .ValidateBasic ()
375
+ expPass := tc .expError == nil
376
+ if expPass {
377
+ s .Require ().NoError (err )
378
+ } else {
379
+ ibctesting .RequireErrorIsOrContains (s .T (), err , tc .expError )
380
+ }
381
+ })
382
+ }
383
+ }
0 commit comments