From 2c3bf5e8c2b51d936a2021263f69ce985fa77a34 Mon Sep 17 00:00:00 2001 From: Youngtaek Yoon Date: Tue, 18 Oct 2022 07:18:49 +0000 Subject: [PATCH] Add unit tests on query cli --- x/foundation/client/testutil/query.go | 47 +++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/x/foundation/client/testutil/query.go b/x/foundation/client/testutil/query.go index 53f8d8581f..6f985b3fdf 100644 --- a/x/foundation/client/testutil/query.go +++ b/x/foundation/client/testutil/query.go @@ -179,6 +179,13 @@ func (s *IntegrationTestSuite) TestNewQueryCmdMember() { false, nil, }, + "invalid member": { + []string{ + "", + }, + false, + nil, + }, } for name, tc := range testCases { @@ -265,6 +272,12 @@ func (s *IntegrationTestSuite) TestNewQueryCmdProposal() { }, false, }, + "invalid id": { + []string{ + fmt.Sprintf("%d", -1), + }, + false, + }, } for name, tc := range testCases { @@ -352,6 +365,20 @@ func (s *IntegrationTestSuite) TestNewQueryCmdVote() { }, false, }, + "invalid proposal id": { + []string{ + fmt.Sprintf("%d", -1), + s.permanentMember.String(), + }, + false, + }, + "invalid voter": { + []string{ + fmt.Sprintf("%d", s.proposalID), + "", + }, + false, + }, } for name, tc := range testCases { @@ -396,6 +423,12 @@ func (s *IntegrationTestSuite) TestNewQueryCmdVotes() { }, false, }, + "invalid proposal id": { + []string{ + fmt.Sprintf("%d", -1), + }, + false, + }, } for name, tc := range testCases { @@ -440,6 +473,12 @@ func (s *IntegrationTestSuite) TestNewQueryCmdTallyResult() { }, false, }, + "invalid proposal id": { + []string{ + fmt.Sprintf("%d", -1), + }, + false, + }, } for name, tc := range testCases { @@ -496,6 +535,14 @@ func (s *IntegrationTestSuite) TestNewQueryCmdGrants() { false, 0, }, + "invalid grantee": { + []string{ + "", + foundation.ReceiveFromTreasuryAuthorization{}.MsgTypeURL(), + }, + false, + 0, + }, } for name, tc := range testCases {