TODO projectsV1Deprecation Remove this test.
(t *testing.T)
| 883 | // TODO projectsV1Deprecation |
| 884 | // Remove this test. |
| 885 | func TestProjectsV1Deprecation(t *testing.T) { |
| 886 | t.Run("when projects v1 is supported, is included in query", func(t *testing.T) { |
| 887 | ios, _, _, _ := iostreams.Test() |
| 888 | |
| 889 | reg := &httpmock.Registry{} |
| 890 | reg.Register( |
| 891 | httpmock.GraphQL(`projectCards`), |
| 892 | // Simulate a GraphQL error to early exit the test. |
| 893 | httpmock.StatusStringResponse(500, ""), |
| 894 | ) |
| 895 | |
| 896 | f := &cmdutil.Factory{ |
| 897 | IOStreams: ios, |
| 898 | HttpClient: func() (*http.Client, error) { |
| 899 | return &http.Client{Transport: reg}, nil |
| 900 | }, |
| 901 | } |
| 902 | |
| 903 | _, cmdTeardown := run.Stub() |
| 904 | defer cmdTeardown(t) |
| 905 | |
| 906 | // Ignore the error because we have no way to really stub it without |
| 907 | // fully stubbing a GQL error structure in the request body. |
| 908 | _ = viewRun(&ViewOptions{ |
| 909 | IO: ios, |
| 910 | Finder: shared.NewFinder(f), |
| 911 | Detector: &fd.EnabledDetectorMock{}, |
| 912 | |
| 913 | SelectorArg: "https://github.com/cli/cli/pull/123", |
| 914 | }) |
| 915 | |
| 916 | // Verify that our request contained projectCards |
| 917 | reg.Verify(t) |
| 918 | }) |
| 919 | |
| 920 | t.Run("when projects v1 is not supported, is not included in query", func(t *testing.T) { |
| 921 | ios, _, _, _ := iostreams.Test() |
| 922 | |
| 923 | reg := &httpmock.Registry{} |
| 924 | reg.Exclude( |
| 925 | t, |
| 926 | httpmock.GraphQL(`projectCards`), |
| 927 | ) |
| 928 | |
| 929 | f := &cmdutil.Factory{ |
| 930 | IOStreams: ios, |
| 931 | HttpClient: func() (*http.Client, error) { |
| 932 | return &http.Client{Transport: reg}, nil |
| 933 | }, |
| 934 | } |
| 935 | |
| 936 | _, cmdTeardown := run.Stub() |
| 937 | defer cmdTeardown(t) |
| 938 | |
| 939 | // Ignore the error because we have no way to really stub it without |
| 940 | // fully stubbing a GQL error structure in the request body. |
| 941 | _ = viewRun(&ViewOptions{ |
| 942 | IO: ios, |