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