(t *testing.T)
| 2096 | } |
| 2097 | |
| 2098 | func Test_createRun_GHES(t *testing.T) { |
| 2099 | tests := []struct { |
| 2100 | name string |
| 2101 | setup func(*CreateOptions, *testing.T) func() |
| 2102 | cmdStubs func(*run.CommandStubber) |
| 2103 | promptStubs func(*prompter.PrompterMock) |
| 2104 | httpStubs func(*httpmock.Registry, *testing.T) |
| 2105 | expectedOutputs []string |
| 2106 | expectedOut string |
| 2107 | expectedErrOut string |
| 2108 | tty bool |
| 2109 | customBranchConfig bool |
| 2110 | }{ |
| 2111 | { |
| 2112 | name: "dry-run-nontty-with-all-opts", |
| 2113 | tty: false, |
| 2114 | setup: func(opts *CreateOptions, t *testing.T) func() { |
| 2115 | opts.TitleProvided = true |
| 2116 | opts.BodyProvided = true |
| 2117 | opts.Title = "TITLE" |
| 2118 | opts.Body = "BODY" |
| 2119 | opts.BaseBranch = "trunk" |
| 2120 | opts.HeadBranch = "feature" |
| 2121 | opts.Assignees = []string{"monalisa"} |
| 2122 | opts.Labels = []string{"bug", "todo"} |
| 2123 | opts.Reviewers = []string{"hubot", "monalisa", "OWNER/core", "OWNER/robots"} |
| 2124 | opts.Milestone = "big one.oh" |
| 2125 | opts.DryRun = true |
| 2126 | return func() {} |
| 2127 | }, |
| 2128 | httpStubs: func(reg *httpmock.Registry, t *testing.T) { |
| 2129 | reg.Register( |
| 2130 | httpmock.GraphQL(`query UserCurrent\b`), |
| 2131 | httpmock.StringResponse(`{"data": {"viewer": {"login": "OWNER"} } }`)) |
| 2132 | reg.Register( |
| 2133 | httpmock.GraphQL(`query RepositoryAssignableUsers\b`), |
| 2134 | httpmock.StringResponse(` |
| 2135 | { "data": { "repository": { "assignableUsers": { |
| 2136 | "nodes": [ |
| 2137 | { "login": "hubot", "id": "HUBOTID", "name": "" }, |
| 2138 | { "login": "MonaLisa", "id": "MONAID", "name": "Mona Display Name" } |
| 2139 | ], |
| 2140 | "pageInfo": { "hasNextPage": false } |
| 2141 | } } } } |
| 2142 | `)) |
| 2143 | reg.Register( |
| 2144 | httpmock.GraphQL(`query RepositoryLabelList\b`), |
| 2145 | httpmock.StringResponse(` |
| 2146 | { "data": { "repository": { "labels": { |
| 2147 | "nodes": [ |
| 2148 | { "name": "TODO", "id": "TODOID" }, |
| 2149 | { "name": "bug", "id": "BUGID" } |
| 2150 | ], |
| 2151 | "pageInfo": { "hasNextPage": false } |
| 2152 | } } } } |
| 2153 | `)) |
| 2154 | reg.Register( |
| 2155 | httpmock.GraphQL(`query RepositoryMilestoneList\b`), |
nothing calls this directly
no test coverage detected