(t *testing.T)
| 63 | } |
| 64 | |
| 65 | func TestIssueGraphQL(t *testing.T) { |
| 66 | tests := []struct { |
| 67 | name string |
| 68 | fields []string |
| 69 | want string |
| 70 | }{ |
| 71 | { |
| 72 | name: "empty", |
| 73 | fields: []string(nil), |
| 74 | want: "", |
| 75 | }, |
| 76 | { |
| 77 | name: "simple fields", |
| 78 | fields: []string{"number", "title"}, |
| 79 | want: "number,title", |
| 80 | }, |
| 81 | { |
| 82 | name: "fields with nested structures", |
| 83 | fields: []string{"author", "assignees"}, |
| 84 | want: "author{login,...on User{id,name}},assignees(first:100){nodes{id,login,name,databaseId},totalCount}", |
| 85 | }, |
| 86 | { |
| 87 | name: "compressed query", |
| 88 | fields: []string{"files"}, |
| 89 | want: "files(first: 100) {nodes {additions,deletions,path,changeType}}", |
| 90 | }, |
| 91 | { |
| 92 | name: "projectItems", |
| 93 | fields: []string{"projectItems"}, |
| 94 | want: `projectItems(first:100){nodes{id, project{id,title}, status:fieldValueByName(name: "Status") { ... on ProjectV2ItemFieldSingleSelectValue{optionId,name}}},totalCount}`, |
| 95 | }, |
| 96 | { |
| 97 | name: "repository", |
| 98 | fields: []string{"repository"}, |
| 99 | want: "repository{id,name,nameWithOwner,databaseId,viewerPermission}", |
| 100 | }, |
| 101 | } |
| 102 | for _, tt := range tests { |
| 103 | t.Run(tt.name, func(t *testing.T) { |
| 104 | if got := IssueGraphQL(tt.fields); got != tt.want { |
| 105 | t.Errorf("IssueGraphQL() = %v, want %v", got, tt.want) |
| 106 | } |
| 107 | }) |
| 108 | } |
| 109 | } |
nothing calls this directly
no test coverage detected