TODO projectsV1Deprecation Remove this test.
(t *testing.T)
| 1398 | // TODO projectsV1Deprecation |
| 1399 | // Remove this test. |
| 1400 | func TestProjectsV1Deprecation(t *testing.T) { |
| 1401 | t.Run("when projects v1 is supported, is included in query", func(t *testing.T) { |
| 1402 | ios, _, _, _ := iostreams.Test() |
| 1403 | |
| 1404 | reg := &httpmock.Registry{} |
| 1405 | reg.Register( |
| 1406 | httpmock.GraphQL(`projectCards`), |
| 1407 | // Simulate a GraphQL error to early exit the test. |
| 1408 | httpmock.StatusStringResponse(500, ""), |
| 1409 | ) |
| 1410 | |
| 1411 | f := &cmdutil.Factory{ |
| 1412 | IOStreams: ios, |
| 1413 | HttpClient: func() (*http.Client, error) { |
| 1414 | return &http.Client{Transport: reg}, nil |
| 1415 | }, |
| 1416 | } |
| 1417 | |
| 1418 | // Ignore the error because we have no way to really stub it without |
| 1419 | // fully stubbing a GQL error structure in the request body. |
| 1420 | _ = editRun(&EditOptions{ |
| 1421 | IO: ios, |
| 1422 | HttpClient: func() (*http.Client, error) { |
| 1423 | return &http.Client{Transport: reg}, nil |
| 1424 | }, |
| 1425 | Detector: &fd.EnabledDetectorMock{}, |
| 1426 | |
| 1427 | Finder: shared.NewFinder(f), |
| 1428 | |
| 1429 | SelectorArg: "https://github.com/cli/cli/pull/123", |
| 1430 | }) |
| 1431 | |
| 1432 | // Verify that our request contained projectCards |
| 1433 | reg.Verify(t) |
| 1434 | }) |
| 1435 | |
| 1436 | t.Run("when projects v1 is not supported, is not included in query", func(t *testing.T) { |
| 1437 | ios, _, _, _ := iostreams.Test() |
| 1438 | |
| 1439 | reg := &httpmock.Registry{} |
| 1440 | reg.Exclude(t, httpmock.GraphQL(`projectCards`)) |
| 1441 | |
| 1442 | f := &cmdutil.Factory{ |
| 1443 | IOStreams: ios, |
| 1444 | HttpClient: func() (*http.Client, error) { |
| 1445 | return &http.Client{Transport: reg}, nil |
| 1446 | }, |
| 1447 | } |
| 1448 | |
| 1449 | // Ignore the error because we have no way to really stub it without |
| 1450 | // fully stubbing a GQL error structure in the request body. |
| 1451 | _ = editRun(&EditOptions{ |
| 1452 | IO: ios, |
| 1453 | HttpClient: func() (*http.Client, error) { |
| 1454 | return &http.Client{Transport: reg}, nil |
| 1455 | }, |
| 1456 | Detector: &fd.DisabledDetectorMock{}, |
| 1457 |