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