TODO projectsV1Deprecation Remove this test.
(t *testing.T)
| 987 | // TODO projectsV1Deprecation |
| 988 | // Remove this test. |
| 989 | func TestProjectsV1Deprecation(t *testing.T) { |
| 990 | t.Run("when projects v1 is supported, is included in query", func(t *testing.T) { |
| 991 | ios, _, _, _ := iostreams.Test() |
| 992 | |
| 993 | reg := &httpmock.Registry{} |
| 994 | reg.Register( |
| 995 | httpmock.GraphQL(`projectCards`), |
| 996 | // Simulate a GraphQL error to early exit the test. |
| 997 | httpmock.StatusStringResponse(500, ""), |
| 998 | ) |
| 999 | |
| 1000 | f := &cmdutil.Factory{ |
| 1001 | IOStreams: ios, |
| 1002 | HttpClient: func() (*http.Client, error) { |
| 1003 | return &http.Client{Transport: reg}, nil |
| 1004 | }, |
| 1005 | } |
| 1006 | |
| 1007 | _, cmdTeardown := run.Stub() |
| 1008 | defer cmdTeardown(t) |
| 1009 | |
| 1010 | // Ignore the error because we have no way to really stub it without |
| 1011 | // fully stubbing a GQL error structure in the request body. |
| 1012 | _ = viewRun(&ViewOptions{ |
| 1013 | IO: ios, |
| 1014 | Finder: shared.NewFinder(f), |
| 1015 | Detector: &fd.EnabledDetectorMock{}, |
| 1016 | |
| 1017 | SelectorArg: "https://github.com/cli/cli/pull/123", |
| 1018 | }) |
| 1019 | |
| 1020 | // Verify that our request contained projectCards |
| 1021 | reg.Verify(t) |
| 1022 | }) |
| 1023 | |
| 1024 | t.Run("when projects v1 is not supported, is not included in query", func(t *testing.T) { |
| 1025 | ios, _, _, _ := iostreams.Test() |
| 1026 | |
| 1027 | reg := &httpmock.Registry{} |
| 1028 | reg.Exclude( |
| 1029 | t, |
| 1030 | httpmock.GraphQL(`projectCards`), |
| 1031 | ) |
| 1032 | |
| 1033 | f := &cmdutil.Factory{ |
| 1034 | IOStreams: ios, |
| 1035 | HttpClient: func() (*http.Client, error) { |
| 1036 | return &http.Client{Transport: reg}, nil |
| 1037 | }, |
| 1038 | } |
| 1039 | |
| 1040 | _, cmdTeardown := run.Stub() |
| 1041 | defer cmdTeardown(t) |
| 1042 | |
| 1043 | // Ignore the error because we have no way to really stub it without |
| 1044 | // fully stubbing a GQL error structure in the request body. |
| 1045 | _ = viewRun(&ViewOptions{ |
| 1046 | IO: ios, |