(t *testing.T)
| 290 | } |
| 291 | |
| 292 | func TestPRList_web(t *testing.T) { |
| 293 | tests := []struct { |
| 294 | name string |
| 295 | cli string |
| 296 | expectedBrowserURL string |
| 297 | }{ |
| 298 | { |
| 299 | name: "filters", |
| 300 | cli: "-a peter -l bug -l docs -L 10 -s merged -B trunk", |
| 301 | expectedBrowserURL: "https://github.com/OWNER/REPO/pulls?q=assignee%3Apeter+base%3Atrunk+is%3Amerged+label%3Abug+label%3Adocs+type%3Apr", |
| 302 | }, |
| 303 | { |
| 304 | name: "draft", |
| 305 | cli: "--draft=true", |
| 306 | expectedBrowserURL: "https://github.com/OWNER/REPO/pulls?q=draft%3Atrue+state%3Aopen+type%3Apr", |
| 307 | }, |
| 308 | { |
| 309 | name: "non-draft", |
| 310 | cli: "--draft=0", |
| 311 | expectedBrowserURL: "https://github.com/OWNER/REPO/pulls?q=draft%3Afalse+state%3Aopen+type%3Apr", |
| 312 | }, |
| 313 | } |
| 314 | |
| 315 | for _, test := range tests { |
| 316 | t.Run(test.name, func(t *testing.T) { |
| 317 | http := initFakeHTTP() |
| 318 | defer http.Verify(t) |
| 319 | |
| 320 | _, cmdTeardown := run.Stub() |
| 321 | defer cmdTeardown(t) |
| 322 | |
| 323 | output, err := runCommand(http, nil, true, "--web "+test.cli) |
| 324 | if err != nil { |
| 325 | t.Errorf("error running command `pr list` with `--web` flag: %v", err) |
| 326 | } |
| 327 | |
| 328 | assert.Equal(t, "", output.String()) |
| 329 | assert.Equal(t, "Opening https://github.com/OWNER/REPO/pulls in your browser.\n", output.Stderr()) |
| 330 | assert.Equal(t, test.expectedBrowserURL, output.BrowsedURL) |
| 331 | }) |
| 332 | } |
| 333 | } |
| 334 | |
| 335 | func TestPRList_withProjectItems(t *testing.T) { |
| 336 | reg := &httpmock.Registry{} |
nothing calls this directly
no test coverage detected