(t *testing.T)
| 381 | } |
| 382 | |
| 383 | func TestRepoList_nontty(t *testing.T) { |
| 384 | ios, _, stdout, stderr := iostreams.Test() |
| 385 | ios.SetStdoutTTY(false) |
| 386 | ios.SetStdinTTY(false) |
| 387 | ios.SetStderrTTY(false) |
| 388 | |
| 389 | httpReg := &httpmock.Registry{} |
| 390 | defer httpReg.Verify(t) |
| 391 | |
| 392 | httpReg.Register( |
| 393 | httpmock.GraphQL(`query RepositoryList\b`), |
| 394 | httpmock.FileResponse("./fixtures/repoList.json"), |
| 395 | ) |
| 396 | |
| 397 | opts := ListOptions{ |
| 398 | IO: ios, |
| 399 | HttpClient: func() (*http.Client, error) { |
| 400 | return &http.Client{Transport: httpReg}, nil |
| 401 | }, |
| 402 | Config: func() (gh.Config, error) { |
| 403 | return config.NewBlankConfig(), nil |
| 404 | }, |
| 405 | Now: func() time.Time { |
| 406 | t, _ := time.Parse(time.RFC822, "19 Feb 21 15:00 UTC") |
| 407 | return t |
| 408 | }, |
| 409 | Limit: 30, |
| 410 | } |
| 411 | |
| 412 | err := listRun(&opts) |
| 413 | assert.NoError(t, err) |
| 414 | |
| 415 | assert.Equal(t, "", stderr.String()) |
| 416 | |
| 417 | assert.Equal(t, heredoc.Doc(` |
| 418 | octocat/hello-world My first repository public 2021-02-19T06:34:58Z |
| 419 | octocat/cli GitHub CLI public, fork 2021-02-19T06:06:06Z |
| 420 | octocat/testing private 2021-02-11T22:32:05Z |
| 421 | `), stdout.String()) |
| 422 | } |
| 423 | |
| 424 | func TestRepoList_tty(t *testing.T) { |
| 425 | ios, _, stdout, stderr := iostreams.Test() |
nothing calls this directly
no test coverage detected