(t *testing.T)
| 56 | } |
| 57 | |
| 58 | func TestIssueStatus(t *testing.T) { |
| 59 | http := &httpmock.Registry{} |
| 60 | defer http.Verify(t) |
| 61 | |
| 62 | http.Register( |
| 63 | httpmock.GraphQL(`query UserCurrent\b`), |
| 64 | httpmock.StringResponse(`{"data":{"viewer":{"login":"octocat"}}}`)) |
| 65 | http.Register( |
| 66 | httpmock.GraphQL(`query IssueStatus\b`), |
| 67 | httpmock.FileResponse("./fixtures/issueStatus.json")) |
| 68 | |
| 69 | output, err := runCommand(http, true, "") |
| 70 | if err != nil { |
| 71 | t.Errorf("error running command `issue status`: %v", err) |
| 72 | } |
| 73 | |
| 74 | expectedIssues := []*regexp.Regexp{ |
| 75 | regexp.MustCompile(`(?m)8.*carrots.*about.*ago`), |
| 76 | regexp.MustCompile(`(?m)9.*squash.*about.*ago`), |
| 77 | regexp.MustCompile(`(?m)10.*broccoli.*about.*ago`), |
| 78 | regexp.MustCompile(`(?m)11.*swiss chard.*about.*ago`), |
| 79 | } |
| 80 | |
| 81 | for _, r := range expectedIssues { |
| 82 | if !r.MatchString(output.String()) { |
| 83 | t.Errorf("output did not match regexp /%s/\n> output\n%s\n", r, output) |
| 84 | return |
| 85 | } |
| 86 | } |
| 87 | } |
| 88 | |
| 89 | func TestIssueStatus_blankSlate(t *testing.T) { |
| 90 | http := &httpmock.Registry{} |
nothing calls this directly
no test coverage detected