(t *testing.T)
| 1924 | } |
| 1925 | |
| 1926 | func 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 | |
| 1966 | func TestPrAddToMergeQueueBlocked(t *testing.T) { |
| 1967 | http := initFakeHTTP() |
nothing calls this directly
no test coverage detected