forked from cli/cli
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathquery_builder_test.go
More file actions
39 lines (37 loc) · 850 Bytes
/
query_builder_test.go
File metadata and controls
39 lines (37 loc) · 850 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package api
import "testing"
func TestPullRequestGraphQL(t *testing.T) {
tests := []struct {
name string
fields []string
want string
}{
{
name: "empty",
fields: []string(nil),
want: "",
},
{
name: "simple fields",
fields: []string{"number", "title"},
want: "number,title",
},
{
name: "fields with nested structures",
fields: []string{"author", "assignees"},
want: "author{login},assignees(first:100){nodes{id,login,name},totalCount}",
},
{
name: "compressed query",
fields: []string{"files"},
want: "files(first: 100) {nodes {additions,deletions,path}}",
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := PullRequestGraphQL(tt.fields); got != tt.want {
t.Errorf("PullRequestGraphQL() = %v, want %v", got, tt.want)
}
})
}
}