(t *testing.T)
| 422 | } |
| 423 | |
| 424 | func TestRepoList_tty(t *testing.T) { |
| 425 | ios, _, stdout, stderr := iostreams.Test() |
| 426 | ios.SetStdoutTTY(true) |
| 427 | ios.SetStdinTTY(true) |
| 428 | ios.SetStderrTTY(true) |
| 429 | |
| 430 | httpReg := &httpmock.Registry{} |
| 431 | defer httpReg.Verify(t) |
| 432 | |
| 433 | httpReg.Register( |
| 434 | httpmock.GraphQL(`query RepositoryList\b`), |
| 435 | httpmock.FileResponse("./fixtures/repoList.json"), |
| 436 | ) |
| 437 | |
| 438 | opts := ListOptions{ |
| 439 | IO: ios, |
| 440 | HttpClient: func() (*http.Client, error) { |
| 441 | return &http.Client{Transport: httpReg}, nil |
| 442 | }, |
| 443 | Config: func() (gh.Config, error) { |
| 444 | return config.NewBlankConfig(), nil |
| 445 | }, |
| 446 | Now: func() time.Time { |
| 447 | t, _ := time.Parse(time.RFC822, "19 Feb 21 15:00 UTC") |
| 448 | return t |
| 449 | }, |
| 450 | Limit: 30, |
| 451 | } |
| 452 | |
| 453 | err := listRun(&opts) |
| 454 | assert.NoError(t, err) |
| 455 | |
| 456 | assert.Equal(t, "", stderr.String()) |
| 457 | |
| 458 | assert.Equal(t, heredoc.Doc(` |
| 459 | |
| 460 | Showing 3 of 3 repositories in @octocat |
| 461 | |
| 462 | NAME DESCRIPTION INFO UPDATED |
| 463 | octocat/hello-world My first repository public about 8 hours ago |
| 464 | octocat/cli GitHub CLI public, fork about 8 hours ago |
| 465 | octocat/testing private about 7 days ago |
| 466 | `), stdout.String()) |
| 467 | } |
| 468 | |
| 469 | func TestRepoList_filtering(t *testing.T) { |
| 470 | http := &httpmock.Registry{} |
nothing calls this directly
no test coverage detected