MCPcopy
hub / github.com/cli/cli / TestIssueList_web

Function TestIssueList_web

pkg/cmd/issue/list/list_test.go:243–307  ·  view source on GitHub ↗

TODO advancedIssueSearchCleanup Simplify this test to only a single test case once GHES 3.17 support ends.

(t *testing.T)

Source from the content-addressed store, hash-verified

241// TODO advancedIssueSearchCleanup
242// Simplify this test to only a single test case once GHES 3.17 support ends.
243func 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

Callers

nothing calls this directly

Calls 11

VerifyMethod · 0.95
VerifyMethod · 0.95
TestFunction · 0.92
StubFunction · 0.92
NewFunction · 0.92
SetStdoutTTYMethod · 0.80
SetStderrTTYMethod · 0.80
EqualMethod · 0.80
listRunFunction · 0.70
RunMethod · 0.65
StringMethod · 0.45

Tested by

no test coverage detected