(t *testing.T)
| 1964 | } |
| 1965 | |
| 1966 | func 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 | |
| 2006 | func TestPrAddToMergeQueueAdmin(t *testing.T) { |
| 2007 | http := initFakeHTTP() |
nothing calls this directly
no test coverage detected