fix pr filtering
This commit is contained in:
parent
667704d574
commit
e3a11c8ffb
2 changed files with 8 additions and 6 deletions
|
|
@ -126,14 +126,16 @@ func prList(cmd *cobra.Command, args []string) error {
|
|||
return err
|
||||
}
|
||||
|
||||
var graphqlState string
|
||||
var graphqlState []string
|
||||
switch state {
|
||||
case "open":
|
||||
graphqlState = "OPEN"
|
||||
graphqlState = []string{"OPEN"}
|
||||
case "closed":
|
||||
graphqlState = "CLOSED"
|
||||
graphqlState = []string{"CLOSED"}
|
||||
case "merged":
|
||||
graphqlState = []string{"MERGED"}
|
||||
case "all":
|
||||
graphqlState = "ALL"
|
||||
graphqlState = []string{"OPEN", "CLOSED", "MERGED"}
|
||||
default:
|
||||
return fmt.Errorf("invalid state: %s", state)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -107,13 +107,13 @@ func TestPRList_filtering(t *testing.T) {
|
|||
bodyBytes, _ := ioutil.ReadAll(http.Requests[0].Body)
|
||||
reqBody := struct {
|
||||
Variables struct {
|
||||
State string
|
||||
State []string
|
||||
Labels []string
|
||||
}
|
||||
}{}
|
||||
json.Unmarshal(bodyBytes, &reqBody)
|
||||
|
||||
eq(t, reqBody.Variables.State, "ALL")
|
||||
eq(t, reqBody.Variables.State, []string{"OPEN", "CLOSED", "MERGED"})
|
||||
eq(t, reqBody.Variables.Labels, []string{"one", "two"})
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue