From 4bb0b6895f7c127d5d7dc937a28ab54d2e0f7fe5 Mon Sep 17 00:00:00 2001 From: expertdicer <expertdicer@gmail.com> Date: Tue, 7 Mar 2023 11:06:46 +0700 Subject: [PATCH 1/2] Cleanup msg validate basic test --- modules/core/03-connection/types/msgs_test.go | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/modules/core/03-connection/types/msgs_test.go b/modules/core/03-connection/types/msgs_test.go index 690a8bb721d..69f3a6714d3 100644 --- a/modules/core/03-connection/types/msgs_test.go +++ b/modules/core/03-connection/types/msgs_test.go @@ -215,22 +215,22 @@ func (suite *MsgTestSuite) TestNewMsgConnectionOpenConfirm() { } testCases := []struct { + name string msg *types.MsgConnectionOpenConfirm expPass bool - errMsg string }{ - {testMsgs[0], false, "invalid connection ID"}, - {testMsgs[1], false, "empty proofTry"}, - {testMsgs[2], false, "empty signer"}, - {testMsgs[3], true, "success"}, + {"invalid connection ID", testMsgs[0], false}, + {"empty proofTry", testMsgs[1], false}, + {"empty signer", testMsgs[2], false}, + {"success", testMsgs[3], true}, } - for i, tc := range testCases { + for _, tc := range testCases { err := tc.msg.ValidateBasic() if tc.expPass { - suite.Require().NoError(err, "Msg %d failed: %s", i, tc.errMsg) + suite.Require().NoError(err, tc.name) } else { - suite.Require().Error(err, "Invalid Msg %d passed: %s", i, tc.errMsg) + suite.Require().Error(err, tc.name) } } } From 1a7d52a5c821352101ea8ec2da44b41e8e644409 Mon Sep 17 00:00:00 2001 From: expertdicer <expertdicer@gmail.com> Date: Wed, 8 Mar 2023 10:27:44 +0700 Subject: [PATCH 2/2] remove testMsgs slice --- modules/core/03-connection/types/msgs_test.go | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/modules/core/03-connection/types/msgs_test.go b/modules/core/03-connection/types/msgs_test.go index 86b877ce05b..0db720e1fc5 100644 --- a/modules/core/03-connection/types/msgs_test.go +++ b/modules/core/03-connection/types/msgs_test.go @@ -208,22 +208,15 @@ func (suite *MsgTestSuite) TestNewMsgConnectionOpenAck() { } func (suite *MsgTestSuite) TestNewMsgConnectionOpenConfirm() { - testMsgs := []*types.MsgConnectionOpenConfirm{ - types.NewMsgConnectionOpenConfirm("test/conn1", suite.proof, clientHeight, signer), - types.NewMsgConnectionOpenConfirm(connectionID, emptyProof, clientHeight, signer), - types.NewMsgConnectionOpenConfirm(connectionID, suite.proof, clientHeight, ""), - types.NewMsgConnectionOpenConfirm(connectionID, suite.proof, clientHeight, signer), - } - testCases := []struct { name string msg *types.MsgConnectionOpenConfirm expPass bool }{ - {"invalid connection ID", testMsgs[0], false}, - {"empty proofTry", testMsgs[1], false}, - {"empty signer", testMsgs[2], false}, - {"success", testMsgs[3], true}, + {"invalid connection ID", types.NewMsgConnectionOpenConfirm("test/conn1", suite.proof, clientHeight, signer), false}, + {"empty proofTry", types.NewMsgConnectionOpenConfirm(connectionID, emptyProof, clientHeight, signer), false}, + {"empty signer", types.NewMsgConnectionOpenConfirm(connectionID, suite.proof, clientHeight, ""), false}, + {"success", types.NewMsgConnectionOpenConfirm(connectionID, suite.proof, clientHeight, signer), true}, } for _, tc := range testCases {