Skip to content

Commit

Permalink
Add unit tests on query cli
Browse files Browse the repository at this point in the history
  • Loading branch information
0Tech committed Oct 18, 2022
1 parent 436d2b0 commit 2c3bf5e
Showing 1 changed file with 47 additions and 0 deletions.
47 changes: 47 additions & 0 deletions x/foundation/client/testutil/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,13 @@ func (s *IntegrationTestSuite) TestNewQueryCmdMember() {
false,
nil,
},
"invalid member": {
[]string{
"",
},
false,
nil,
},
}

for name, tc := range testCases {
Expand Down Expand Up @@ -265,6 +272,12 @@ func (s *IntegrationTestSuite) TestNewQueryCmdProposal() {
},
false,
},
"invalid id": {
[]string{
fmt.Sprintf("%d", -1),
},
false,
},
}

for name, tc := range testCases {
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -396,6 +423,12 @@ func (s *IntegrationTestSuite) TestNewQueryCmdVotes() {
},
false,
},
"invalid proposal id": {
[]string{
fmt.Sprintf("%d", -1),
},
false,
},
}

for name, tc := range testCases {
Expand Down Expand Up @@ -440,6 +473,12 @@ func (s *IntegrationTestSuite) TestNewQueryCmdTallyResult() {
},
false,
},
"invalid proposal id": {
[]string{
fmt.Sprintf("%d", -1),
},
false,
},
}

for name, tc := range testCases {
Expand Down Expand Up @@ -496,6 +535,14 @@ func (s *IntegrationTestSuite) TestNewQueryCmdGrants() {
false,
0,
},
"invalid grantee": {
[]string{
"",
foundation.ReceiveFromTreasuryAuthorization{}.MsgTypeURL(),
},
false,
0,
},
}

for name, tc := range testCases {
Expand Down

0 comments on commit 2c3bf5e

Please sign in to comment.