MCPcopy Index your code
hub / github.com/cli/cli / TestPullRequestGraphQL

Function TestPullRequestGraphQL

api/query_builder_test.go:5–49  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

3import "testing"
4
5func TestPullRequestGraphQL(t *testing.T) {
6 tests := []struct {
7 name string
8 fields []string
9 want string
10 }{
11 {
12 name: "empty",
13 fields: []string(nil),
14 want: "",
15 },
16 {
17 name: "simple fields",
18 fields: []string{"number", "title"},
19 want: "number,title",
20 },
21 {
22 name: "fields with nested structures",
23 fields: []string{"author", "assignees"},
24 want: "author{login,...on User{id,name}},assignees(first:100){nodes{id,login,name,databaseId},totalCount}",
25 },
26 {
27 name: "compressed query",
28 fields: []string{"files"},
29 want: "files(first: 100) {nodes {additions,deletions,path,changeType}}",
30 },
31 {
32 name: "invalid fields",
33 fields: []string{"isPinned", "stateReason", "number"},
34 want: "number",
35 },
36 {
37 name: "projectItems",
38 fields: []string{"projectItems"},
39 want: `projectItems(first:100){nodes{id, project{id,title}, status:fieldValueByName(name: "Status") { ... on ProjectV2ItemFieldSingleSelectValue{optionId,name}}},totalCount}`,
40 },
41 }
42 for _, tt := range tests {
43 t.Run(tt.name, func(t *testing.T) {
44 if got := PullRequestGraphQL(tt.fields); got != tt.want {
45 t.Errorf("PullRequestGraphQL() = %v, want %v", got, tt.want)
46 }
47 })
48 }
49}
50
51func TestIssueGraphQL(t *testing.T) {
52 tests := []struct {

Callers

nothing calls this directly

Calls 3

PullRequestGraphQLFunction · 0.85
RunMethod · 0.65
ErrorfMethod · 0.65

Tested by

no test coverage detected