MCPcopy Index your code
hub / github.com/cli/cli / TestPRRevert_notRevertable

Function TestPRRevert_notRevertable

pkg/cmd/pr/revert/revert_test.go:126–144  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

124}
125
126func TestPRRevert_notRevertable(t *testing.T) {
127 http := &httpmock.Registry{}
128 defer http.Verify(t)
129
130 shared.StubFinderForRunCommandStyleTests(t, "123", &api.PullRequest{
131 ID: "SOME-ID",
132 Number: 123,
133 State: "OPEN",
134 Title: "The title of the PR",
135 }, ghrepo.New("OWNER", "REPO"))
136
137 // Target PR is not merged.
138 output, err := runCommand(http, true, "123")
139 // API error, non-zero exit.
140 assert.EqualError(t, err, "SilentError")
141 assert.Equal(t, "X Pull request OWNER/REPO#123 (The title of the PR) can't be reverted because it has not been merged\n", output.Stderr())
142 // No URL printed.
143 assert.Equal(t, "", output.String())
144}
145
146func TestPRRevert_withTitleAndBody(t *testing.T) {
147 http := &httpmock.Registry{}

Callers

nothing calls this directly

Calls 7

VerifyMethod · 0.95
NewFunction · 0.92
EqualMethod · 0.80
StderrMethod · 0.80
runCommandFunction · 0.70
StringMethod · 0.45

Tested by

no test coverage detected