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

Function TestPrAddToMergeQueueWithMergeMethod

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

Source from the content-addressed store, hash-verified

1886}
1887
1888func TestPrAddToMergeQueueWithMergeMethod(t *testing.T) {
1889 http := initFakeHTTP()
1890 defer http.Verify(t)
1891
1892 shared.StubFinderForRunCommandStyleTests(t,
1893 "1",
1894 &api.PullRequest{
1895 ID: "THE-ID",
1896 Number: 1,
1897 State: "OPEN",
1898 Title: "The title of the PR",
1899 MergeStateStatus: "CLEAN",
1900 IsInMergeQueue: false,
1901 IsMergeQueueEnabled: true,
1902 BaseRefName: "main",
1903 },
1904 baseRepo("OWNER", "REPO", "main"),
1905 )
1906 http.Register(
1907 httpmock.GraphQL(`mutation PullRequestAutoMerge\b`),
1908 httpmock.GraphQLMutation(`{}`, func(input map[string]any) {
1909 assert.Equal(t, "THE-ID", input["pullRequestId"].(string))
1910 assert.Equal(t, "MERGE", input["mergeMethod"].(string))
1911 }),
1912 )
1913
1914 cs, cmdTeardown := run.Stub()
1915 defer cmdTeardown(t)
1916 cs.Register(`git rev-parse --verify refs/heads/`, 0, "")
1917
1918 output, err := runCommand(http, nil, "blueberries", true, "pr merge 1 --merge")
1919 if err != nil {
1920 t.Fatalf("error running command `pr merge`: %v", err)
1921 }
1922 assert.Equal(t, "", output.String())
1923 assert.Equal(t, "! The merge strategy for main is set by the merge queue\n✓ Pull request OWNER/REPO#1 will be added to the merge queue for main when ready\n", output.Stderr())
1924}
1925
1926func TestPrAddToMergeQueueClean(t *testing.T) {
1927 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