TODO projectsV1Deprecation Remove this test.
(t *testing.T)
| 1563 | // TODO projectsV1Deprecation |
| 1564 | // Remove this test. |
| 1565 | func TestProjectsV1Deprecation(t *testing.T) { |
| 1566 | |
| 1567 | t.Run("non-interactive submission", func(t *testing.T) { |
| 1568 | t.Run("when projects v1 is supported, queries for it", func(t *testing.T) { |
| 1569 | ios, _, _, _ := iostreams.Test() |
| 1570 | |
| 1571 | reg := &httpmock.Registry{} |
| 1572 | reg.StubIssueRepoInfoResponse("OWNER", "REPO") |
| 1573 | reg.Register( |
| 1574 | // ( is required to avoid matching projectsV2 |
| 1575 | httpmock.GraphQL(`projects\(`), |
| 1576 | // Simulate a GraphQL error to early exit the test. |
| 1577 | httpmock.StatusStringResponse(500, ""), |
| 1578 | ) |
| 1579 | |
| 1580 | _, cmdTeardown := run.Stub() |
| 1581 | defer cmdTeardown(t) |
| 1582 | |
| 1583 | // Ignore the error because we have no way to really stub it without |
| 1584 | // fully stubbing a GQL error structure in the request body. |
| 1585 | _ = createRun(&CreateOptions{ |
| 1586 | IO: ios, |
| 1587 | HttpClient: func() (*http.Client, error) { |
| 1588 | return &http.Client{Transport: reg}, nil |
| 1589 | }, |
| 1590 | BaseRepo: func() (ghrepo.Interface, error) { |
| 1591 | return ghrepo.New("OWNER", "REPO"), nil |
| 1592 | }, |
| 1593 | |
| 1594 | Detector: &fd.EnabledDetectorMock{}, |
| 1595 | Title: "Test Title", |
| 1596 | Body: "Test Body", |
| 1597 | // Required to force a lookup of projects |
| 1598 | Projects: []string{"Project"}, |
| 1599 | }) |
| 1600 | |
| 1601 | // Verify that our request contained projects |
| 1602 | reg.Verify(t) |
| 1603 | }) |
| 1604 | |
| 1605 | t.Run("when projects v1 is not supported, does not query for it", func(t *testing.T) { |
| 1606 | ios, _, _, _ := iostreams.Test() |
| 1607 | |
| 1608 | reg := &httpmock.Registry{} |
| 1609 | reg.StubIssueRepoInfoResponse("OWNER", "REPO") |
| 1610 | // ( is required to avoid matching projectsV2 |
| 1611 | reg.Exclude(t, httpmock.GraphQL(`projects\(`)) |
| 1612 | |
| 1613 | _, cmdTeardown := run.Stub() |
| 1614 | defer cmdTeardown(t) |
| 1615 | |
| 1616 | // Ignore the error because we're not really interested in it. |
| 1617 | _ = createRun(&CreateOptions{ |
| 1618 | IO: ios, |
| 1619 | HttpClient: func() (*http.Client, error) { |
| 1620 | return &http.Client{Transport: reg}, nil |
| 1621 | }, |
| 1622 | BaseRepo: func() (ghrepo.Interface, error) { |
nothing calls this directly
no test coverage detected