(t *testing.T)
| 49 | } |
| 50 | |
| 51 | func TestIssueGraphQL(t *testing.T) { |
| 52 | tests := []struct { |
| 53 | name string |
| 54 | fields []string |
| 55 | want string |
| 56 | }{ |
| 57 | { |
| 58 | name: "empty", |
| 59 | fields: []string(nil), |
| 60 | want: "", |
| 61 | }, |
| 62 | { |
| 63 | name: "simple fields", |
| 64 | fields: []string{"number", "title"}, |
| 65 | want: "number,title", |
| 66 | }, |
| 67 | { |
| 68 | name: "fields with nested structures", |
| 69 | fields: []string{"author", "assignees"}, |
| 70 | want: "author{login,...on User{id,name}},assignees(first:100){nodes{id,login,name,databaseId},totalCount}", |
| 71 | }, |
| 72 | { |
| 73 | name: "compressed query", |
| 74 | fields: []string{"files"}, |
| 75 | want: "files(first: 100) {nodes {additions,deletions,path,changeType}}", |
| 76 | }, |
| 77 | { |
| 78 | name: "projectItems", |
| 79 | fields: []string{"projectItems"}, |
| 80 | want: `projectItems(first:100){nodes{id, project{id,title}, status:fieldValueByName(name: "Status") { ... on ProjectV2ItemFieldSingleSelectValue{optionId,name}}},totalCount}`, |
| 81 | }, |
| 82 | } |
| 83 | for _, tt := range tests { |
| 84 | t.Run(tt.name, func(t *testing.T) { |
| 85 | if got := IssueGraphQL(tt.fields); got != tt.want { |
| 86 | t.Errorf("IssueGraphQL() = %v, want %v", got, tt.want) |
| 87 | } |
| 88 | }) |
| 89 | } |
| 90 | } |
nothing calls this directly
no test coverage detected