(t *testing.T)
| 123 | } |
| 124 | |
| 125 | func TestPRStatus_reviewsAndChecks(t *testing.T) { |
| 126 | http := initFakeHTTP() |
| 127 | defer http.Verify(t) |
| 128 | // status,conclusion matches the old StatusContextRollup query |
| 129 | http.Register(httpmock.GraphQL(`status,conclusion`), httpmock.FileResponse("./fixtures/prStatusChecks.json")) |
| 130 | |
| 131 | // stub successful git command |
| 132 | rs, cleanup := run.Stub() |
| 133 | defer cleanup(t) |
| 134 | rs.Register(`git config --get-regexp \^branch\\.`, 0, "") |
| 135 | rs.Register(`git config remote.pushDefault`, 0, "") |
| 136 | rs.Register(`git rev-parse --symbolic-full-name blueberries@{push}`, 128, "") |
| 137 | rs.Register(`git config push.default`, 1, "") |
| 138 | |
| 139 | output, err := runCommand(http, "blueberries", true, "") |
| 140 | if err != nil { |
| 141 | t.Errorf("error running command `pr status`: %v", err) |
| 142 | } |
| 143 | |
| 144 | expected := []string{ |
| 145 | "✓ Checks passing + Changes requested ! Merge conflict status unknown", |
| 146 | "- Checks pending ✓ 2 Approved", |
| 147 | "× 1/3 checks failing - Review required ✓ No merge conflicts", |
| 148 | "✓ Checks passing × Merge conflicts", |
| 149 | } |
| 150 | |
| 151 | for _, line := range expected { |
| 152 | if !strings.Contains(output.String(), line) { |
| 153 | t.Errorf("output did not contain %q: %q", line, output.String()) |
| 154 | } |
| 155 | } |
| 156 | } |
| 157 | |
| 158 | func TestPRStatus_reviewsAndChecksWithStatesByCount(t *testing.T) { |
| 159 | http := initFakeHTTP() |
nothing calls this directly
no test coverage detected