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

Function TestPrAddToMergeQueueClean

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

Source from the content-addressed store, hash-verified

1924}
1925
1926func TestPrAddToMergeQueueClean(t *testing.T) {
1927 http := initFakeHTTP()
1928 defer http.Verify(t)
1929
1930 shared.StubFinderForRunCommandStyleTests(t,
1931 "1",
1932 &api.PullRequest{
1933 ID: "THE-ID",
1934 Number: 1,
1935 State: "OPEN",
1936 Title: "The title of the PR",
1937 MergeStateStatus: "CLEAN",
1938 IsInMergeQueue: false,
1939 IsMergeQueueEnabled: true,
1940 BaseRefName: "main",
1941 },
1942 baseRepo("OWNER", "REPO", "main"),
1943 )
1944
1945 http.Register(
1946 httpmock.GraphQL(`mutation PullRequestAutoMerge\b`),
1947 httpmock.GraphQLMutation(`{}`, func(input map[string]any) {
1948 assert.Equal(t, "THE-ID", input["pullRequestId"].(string))
1949 assert.Equal(t, "MERGE", input["mergeMethod"].(string))
1950 }),
1951 )
1952
1953 cs, cmdTeardown := run.Stub()
1954 defer cmdTeardown(t)
1955 cs.Register(`git rev-parse --verify refs/heads/`, 0, "")
1956
1957 output, err := runCommand(http, nil, "blueberries", true, "pr merge 1")
1958 if err != nil {
1959 t.Fatalf("error running command `pr merge`: %v", err)
1960 }
1961
1962 assert.Equal(t, "", output.String())
1963 assert.Equal(t, "✓ Pull request OWNER/REPO#1 will be added to the merge queue for main when ready\n", output.Stderr())
1964}
1965
1966func TestPrAddToMergeQueueBlocked(t *testing.T) {
1967 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