(t *testing.T)
| 203 | } |
| 204 | |
| 205 | func TestFind(t *testing.T) { |
| 206 | originOwnerUrl, err := url.Parse("https://github.com/ORIGINOWNER/REPO.git") |
| 207 | if err != nil { |
| 208 | t.Fatal(err) |
| 209 | } |
| 210 | remoteOrigin := ghContext.Remote{ |
| 211 | Remote: &git.Remote{ |
| 212 | Name: "origin", |
| 213 | FetchURL: originOwnerUrl, |
| 214 | }, |
| 215 | Repo: ghrepo.New("ORIGINOWNER", "REPO"), |
| 216 | } |
| 217 | remoteOther := ghContext.Remote{ |
| 218 | Remote: &git.Remote{ |
| 219 | Name: "other", |
| 220 | FetchURL: originOwnerUrl, |
| 221 | }, |
| 222 | Repo: ghrepo.New("ORIGINOWNER", "OTHER-REPO"), |
| 223 | } |
| 224 | |
| 225 | upstreamOwnerUrl, err := url.Parse("https://github.com/UPSTREAMOWNER/REPO.git") |
| 226 | if err != nil { |
| 227 | t.Fatal(err) |
| 228 | } |
| 229 | remoteUpstream := ghContext.Remote{ |
| 230 | Remote: &git.Remote{ |
| 231 | Name: "upstream", |
| 232 | FetchURL: upstreamOwnerUrl, |
| 233 | }, |
| 234 | Repo: ghrepo.New("UPSTREAMOWNER", "REPO"), |
| 235 | } |
| 236 | |
| 237 | tests := []struct { |
| 238 | name string |
| 239 | args args |
| 240 | httpStub func(*httpmock.Registry) |
| 241 | wantUseProgress bool |
| 242 | wantPR int |
| 243 | wantRepo string |
| 244 | wantErr bool |
| 245 | }{ |
| 246 | { |
| 247 | name: "number argument", |
| 248 | args: args{ |
| 249 | selector: "13", |
| 250 | fields: []string{"id", "number"}, |
| 251 | baseRepoFn: stubBaseRepoFn(ghrepo.New("ORIGINOWNER", "REPO"), nil), |
| 252 | branchFn: func() (string, error) { |
| 253 | return "blueberries", nil |
| 254 | }, |
| 255 | }, |
| 256 | httpStub: func(r *httpmock.Registry) { |
| 257 | r.Register( |
| 258 | httpmock.GraphQL(`query PullRequestByNumber\b`), |
| 259 | httpmock.StringResponse(`{"data":{"repository":{ |
| 260 | "pullRequest":{"number":13} |
| 261 | }}}`)) |
| 262 | }, |
nothing calls this directly
no test coverage detected