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

Function TestPrAddToMergeQueueBlocked

pkg/cmd/pr/merge/merge_test.go:1966–2004  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1964}
1965
1966func TestPrAddToMergeQueueBlocked(t *testing.T) {
1967 http := initFakeHTTP()
1968 defer http.Verify(t)
1969
1970 shared.StubFinderForRunCommandStyleTests(t,
1971 "1",
1972 &api.PullRequest{
1973 ID: "THE-ID",
1974 Number: 1,
1975 State: "OPEN",
1976 Title: "The title of the PR",
1977 MergeStateStatus: "BLOCKED",
1978 IsInMergeQueue: false,
1979 IsMergeQueueEnabled: true,
1980 BaseRefName: "main",
1981 },
1982 baseRepo("OWNER", "REPO", "main"),
1983 )
1984
1985 http.Register(
1986 httpmock.GraphQL(`mutation PullRequestAutoMerge\b`),
1987 httpmock.GraphQLMutation(`{}`, func(input map[string]any) {
1988 assert.Equal(t, "THE-ID", input["pullRequestId"].(string))
1989 assert.Equal(t, "MERGE", input["mergeMethod"].(string))
1990 }),
1991 )
1992
1993 cs, cmdTeardown := run.Stub()
1994 defer cmdTeardown(t)
1995 cs.Register(`git rev-parse --verify refs/heads/`, 0, "")
1996
1997 output, err := runCommand(http, nil, "blueberries", true, "pr merge 1")
1998 if err != nil {
1999 t.Fatalf("error running command `pr merge`: %v", err)
2000 }
2001
2002 assert.Equal(t, "", output.String())
2003 assert.Equal(t, "✓ Pull request OWNER/REPO#1 will be added to the merge queue for main when ready\n", output.Stderr())
2004}
2005
2006func TestPrAddToMergeQueueAdmin(t *testing.T) {
2007 http := initFakeHTTP()

Callers

nothing calls this directly

Calls 12

GraphQLFunction · 0.92
GraphQLMutationFunction · 0.92
StubFunction · 0.92
baseRepoFunction · 0.85
EqualMethod · 0.80
StderrMethod · 0.80
initFakeHTTPFunction · 0.70
runCommandFunction · 0.70
VerifyMethod · 0.65
StringMethod · 0.65
RegisterMethod · 0.45

Tested by

no test coverage detected