TODO advancedIssueSearchCleanup Remove this test once GHES 3.17 support ends.
(t *testing.T)
| 170 | // TODO advancedIssueSearchCleanup |
| 171 | // Remove this test once GHES 3.17 support ends. |
| 172 | func TestSearchIssuesAndAdvancedSearch(t *testing.T) { |
| 173 | tests := []struct { |
| 174 | name string |
| 175 | detector fd.Detector |
| 176 | wantSearchType string |
| 177 | }{ |
| 178 | { |
| 179 | name: "advanced issue search not supported", |
| 180 | detector: fd.AdvancedIssueSearchUnsupported(), |
| 181 | wantSearchType: "ISSUE", |
| 182 | }, |
| 183 | { |
| 184 | name: "advanced issue search supported as opt-in", |
| 185 | detector: fd.AdvancedIssueSearchSupportedAsOptIn(), |
| 186 | wantSearchType: "ISSUE_ADVANCED", |
| 187 | }, |
| 188 | { |
| 189 | name: "advanced issue search supported as only backend", |
| 190 | detector: fd.AdvancedIssueSearchSupportedAsOnlyBackend(), |
| 191 | wantSearchType: "ISSUE", |
| 192 | }, |
| 193 | } |
| 194 | |
| 195 | for _, tt := range tests { |
| 196 | t.Run(tt.name, func(t *testing.T) { |
| 197 | reg := &httpmock.Registry{} |
| 198 | defer reg.Verify(t) |
| 199 | |
| 200 | reg.Register( |
| 201 | httpmock.GraphQL(`query IssueSearch\b`), |
| 202 | httpmock.GraphQLQuery(`{"data":{}}`, func(query string, vars map[string]interface{}) { |
| 203 | assert.Equal(t, tt.wantSearchType, vars["type"]) |
| 204 | // Since no repeated usage of special search qualifiers is possible |
| 205 | // with our current implementation, we can assert against the same |
| 206 | // query for both search backend (i.e. legacy and advanced issue search). |
| 207 | assert.Equal(t, "repo:OWNER/REPO state:open type:issue", vars["query"]) |
| 208 | })) |
| 209 | |
| 210 | httpClient := &http.Client{Transport: reg} |
| 211 | client := api.NewClientFromHTTP(httpClient) |
| 212 | |
| 213 | searchIssues(client, tt.detector, ghrepo.New("OWNER", "REPO"), prShared.FilterOptions{State: "open"}, 30) |
| 214 | }) |
| 215 | } |
| 216 | } |
| 217 | |
| 218 | func TestSearchIssues_rejectsPullRequestQualifiers(t *testing.T) { |
| 219 | tests := []struct { |
nothing calls this directly
no test coverage detected