@@ -6,14 +6,18 @@ import (
6
6
7
7
"github.com/stretchr/testify/suite"
8
8
9
+ clienttypes "github.com/cosmos/ibc-go/v9/modules/core/02-client/types"
9
10
channeltypesv1 "github.com/cosmos/ibc-go/v9/modules/core/04-channel/types"
10
11
"github.com/cosmos/ibc-go/v9/modules/core/04-channel/v2/types"
11
12
commitmenttypes "github.com/cosmos/ibc-go/v9/modules/core/23-commitment/types"
12
13
host "github.com/cosmos/ibc-go/v9/modules/core/24-host"
13
14
ibcerrors "github.com/cosmos/ibc-go/v9/modules/core/errors"
14
15
ibctesting "github.com/cosmos/ibc-go/v9/testing"
16
+ mockv2 "github.com/cosmos/ibc-go/v9/testing/mock/v2"
15
17
)
16
18
19
+ var testProof = []byte ("proof" )
20
+
17
21
type TypesTestSuite struct {
18
22
suite.Suite
19
23
@@ -211,3 +215,53 @@ func (s *TypesTestSuite) TestMsgSendPacketValidateBasic() {
211
215
})
212
216
}
213
217
}
218
+
219
+ func (s * TypesTestSuite ) TestMsgAcknowledge_ValidateBasic () {
220
+ var msg * types.MsgAcknowledgement
221
+
222
+ testCases := []struct {
223
+ name string
224
+ malleate func ()
225
+ expError error
226
+ }{
227
+ {
228
+ name : "success" ,
229
+ malleate : func () {},
230
+ },
231
+ {
232
+ name : "failure: invalid signer" ,
233
+ malleate : func () {
234
+ msg .Signer = ""
235
+ },
236
+ expError : ibcerrors .ErrInvalidAddress ,
237
+ },
238
+ {
239
+ name : "failure: invalid packet" ,
240
+ malleate : func () {
241
+ msg .Packet .Sequence = 0
242
+ },
243
+ expError : types .ErrInvalidPacket ,
244
+ },
245
+ }
246
+ for _ , tc := range testCases {
247
+ s .Run (tc .name , func () {
248
+ msg = types .NewMsgAcknowledgement (
249
+ types .NewPacket (1 , ibctesting .FirstChannelID , ibctesting .SecondChannelID , s .chainA .GetTimeoutTimestamp (), mockv2 .NewMockPacketData (mockv2 .ModuleNameA , mockv2 .ModuleNameB )),
250
+ types.Acknowledgement {},
251
+ testProof ,
252
+ clienttypes .ZeroHeight (),
253
+ s .chainA .SenderAccount .GetAddress ().String (),
254
+ )
255
+
256
+ tc .malleate ()
257
+
258
+ err := msg .ValidateBasic ()
259
+ expPass := tc .expError == nil
260
+ if expPass {
261
+ s .Require ().NoError (err )
262
+ } else {
263
+ ibctesting .RequireErrorIsOrContains (s .T (), err , tc .expError )
264
+ }
265
+ })
266
+ }
267
+ }
0 commit comments