TODO advancedIssueSearchCleanup Simplify this test to only a single test case once GHES 3.17 support ends.
(t *testing.T)
| 241 | // TODO advancedIssueSearchCleanup |
| 242 | // Simplify this test to only a single test case once GHES 3.17 support ends. |
| 243 | func TestIssueList_web(t *testing.T) { |
| 244 | tests := []struct { |
| 245 | name string |
| 246 | detector fd.Detector |
| 247 | }{ |
| 248 | { |
| 249 | name: "advanced issue search not supported", |
| 250 | detector: fd.AdvancedIssueSearchUnsupported(), |
| 251 | }, |
| 252 | { |
| 253 | name: "advanced issue search supported as opt-in", |
| 254 | detector: fd.AdvancedIssueSearchSupportedAsOptIn(), |
| 255 | }, |
| 256 | { |
| 257 | name: "advanced issue search supported as only backend", |
| 258 | detector: fd.AdvancedIssueSearchSupportedAsOnlyBackend(), |
| 259 | }, |
| 260 | } |
| 261 | |
| 262 | for _, tt := range tests { |
| 263 | t.Run(tt.name, func(t *testing.T) { |
| 264 | ios, _, stdout, stderr := iostreams.Test() |
| 265 | ios.SetStdoutTTY(true) |
| 266 | ios.SetStderrTTY(true) |
| 267 | browser := &browser.Stub{} |
| 268 | |
| 269 | reg := &httpmock.Registry{} |
| 270 | defer reg.Verify(t) |
| 271 | |
| 272 | _, cmdTeardown := run.Stub() |
| 273 | defer cmdTeardown(t) |
| 274 | |
| 275 | opts := &ListOptions{ |
| 276 | IO: ios, |
| 277 | Browser: browser, |
| 278 | HttpClient: func() (*http.Client, error) { |
| 279 | return &http.Client{Transport: reg}, nil |
| 280 | }, |
| 281 | BaseRepo: func() (ghrepo.Interface, error) { |
| 282 | return ghrepo.New("OWNER", "REPO"), nil |
| 283 | }, |
| 284 | Detector: tt.detector, |
| 285 | WebMode: true, |
| 286 | State: "all", |
| 287 | Assignee: "peter", |
| 288 | Author: "john", |
| 289 | Labels: []string{"bug", "docs"}, |
| 290 | Mention: "frank", |
| 291 | Milestone: "v1.1", |
| 292 | LimitResults: 10, |
| 293 | } |
| 294 | |
| 295 | err := listRun(opts) |
| 296 | require.NoError(t, err) |
| 297 | |
| 298 | assert.Equal(t, "", stdout.String()) |
| 299 | assert.Equal(t, "Opening https://github.com/OWNER/REPO/issues in your browser.\n", stderr.String()) |
| 300 |