MCPcopy Create free account
hub / github.com/cli/cli / TestPRStatus_reviewsAndChecks

Function TestPRStatus_reviewsAndChecks

pkg/cmd/pr/status/status_test.go:125–156  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

123}
124
125func 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
158func TestPRStatus_reviewsAndChecksWithStatesByCount(t *testing.T) {
159 http := initFakeHTTP()

Callers

nothing calls this directly

Calls 10

GraphQLFunction · 0.92
FileResponseFunction · 0.92
StubFunction · 0.92
ContainsMethod · 0.80
initFakeHTTPFunction · 0.70
runCommandFunction · 0.70
VerifyMethod · 0.65
ErrorfMethod · 0.65
StringMethod · 0.65
RegisterMethod · 0.45

Tested by

no test coverage detected