TODO projectsV1Deprecation Remove this test.
(t *testing.T)
| 537 | // TODO projectsV1Deprecation |
| 538 | // Remove this test. |
| 539 | func TestProjectsV1Deprecation(t *testing.T) { |
| 540 | t.Run("when projects v1 is supported, is included in query", func(t *testing.T) { |
| 541 | ios, _, _, _ := iostreams.Test() |
| 542 | |
| 543 | reg := &httpmock.Registry{} |
| 544 | reg.Register( |
| 545 | httpmock.GraphQL(`projectCards`), |
| 546 | // Simulate a GraphQL error to early exit the test. |
| 547 | httpmock.StatusStringResponse(500, ""), |
| 548 | ) |
| 549 | |
| 550 | _, cmdTeardown := run.Stub() |
| 551 | defer cmdTeardown(t) |
| 552 | |
| 553 | // Ignore the error because we have no way to really stub it without |
| 554 | // fully stubbing a GQL error structure in the request body. |
| 555 | _ = viewRun(&ViewOptions{ |
| 556 | IO: ios, |
| 557 | HttpClient: func() (*http.Client, error) { |
| 558 | return &http.Client{Transport: reg}, nil |
| 559 | }, |
| 560 | BaseRepo: func() (ghrepo.Interface, error) { |
| 561 | return ghrepo.New("OWNER", "REPO"), nil |
| 562 | }, |
| 563 | |
| 564 | Detector: &fd.EnabledDetectorMock{}, |
| 565 | IssueNumber: 123, |
| 566 | }) |
| 567 | |
| 568 | // Verify that our request contained projectCards |
| 569 | reg.Verify(t) |
| 570 | }) |
| 571 | |
| 572 | t.Run("when projects v1 is not supported, is not included in query", func(t *testing.T) { |
| 573 | ios, _, _, _ := iostreams.Test() |
| 574 | |
| 575 | reg := &httpmock.Registry{} |
| 576 | reg.Exclude(t, httpmock.GraphQL(`projectCards`)) |
| 577 | |
| 578 | _, cmdTeardown := run.Stub() |
| 579 | defer cmdTeardown(t) |
| 580 | |
| 581 | // Ignore the error because we're not really interested in it. |
| 582 | _ = viewRun(&ViewOptions{ |
| 583 | IO: ios, |
| 584 | HttpClient: func() (*http.Client, error) { |
| 585 | return &http.Client{Transport: reg}, nil |
| 586 | }, |
| 587 | BaseRepo: func() (ghrepo.Interface, error) { |
| 588 | return ghrepo.New("OWNER", "REPO"), nil |
| 589 | }, |
| 590 | |
| 591 | Detector: &fd.DisabledDetectorMock{}, |
| 592 | IssueNumber: 123, |
| 593 | }) |
| 594 | |
| 595 | // Verify that our request contained projectCards |
| 596 | reg.Verify(t) |