TODO projectsV1Deprecation Remove this test.
(t *testing.T)
| 1956 | // TODO projectsV1Deprecation |
| 1957 | // Remove this test. |
| 1958 | func TestProjectsV1Deprecation(t *testing.T) { |
| 1959 | t.Run("when projects v1 is supported, is included in query", func(t *testing.T) { |
| 1960 | ios, _, _, _ := iostreams.Test() |
| 1961 | |
| 1962 | reg := &httpmock.Registry{} |
| 1963 | reg.Register( |
| 1964 | httpmock.GraphQL(`projectCards`), |
| 1965 | // Simulate a GraphQL error to early exit the test. |
| 1966 | httpmock.StatusStringResponse(500, ""), |
| 1967 | ) |
| 1968 | |
| 1969 | f := &cmdutil.Factory{ |
| 1970 | IOStreams: ios, |
| 1971 | HttpClient: func() (*http.Client, error) { |
| 1972 | return &http.Client{Transport: reg}, nil |
| 1973 | }, |
| 1974 | } |
| 1975 | |
| 1976 | // Ignore the error because we have no way to really stub it without |
| 1977 | // fully stubbing a GQL error structure in the request body. |
| 1978 | _ = editRun(&EditOptions{ |
| 1979 | IO: ios, |
| 1980 | HttpClient: func() (*http.Client, error) { |
| 1981 | return &http.Client{Transport: reg}, nil |
| 1982 | }, |
| 1983 | Detector: &fd.EnabledDetectorMock{}, |
| 1984 | |
| 1985 | Finder: shared.NewFinder(f), |
| 1986 | |
| 1987 | SelectorArg: "https://github.com/cli/cli/pull/123", |
| 1988 | }) |
| 1989 | |
| 1990 | // Verify that our request contained projectCards |
| 1991 | reg.Verify(t) |
| 1992 | }) |
| 1993 | |
| 1994 | t.Run("when projects v1 is not supported, is not included in query", func(t *testing.T) { |
| 1995 | ios, _, _, _ := iostreams.Test() |
| 1996 | |
| 1997 | reg := &httpmock.Registry{} |
| 1998 | reg.Exclude(t, httpmock.GraphQL(`projectCards`)) |
| 1999 | |
| 2000 | f := &cmdutil.Factory{ |
| 2001 | IOStreams: ios, |
| 2002 | HttpClient: func() (*http.Client, error) { |
| 2003 | return &http.Client{Transport: reg}, nil |
| 2004 | }, |
| 2005 | } |
| 2006 | |
| 2007 | // Ignore the error because we have no way to really stub it without |
| 2008 | // fully stubbing a GQL error structure in the request body. |
| 2009 | _ = editRun(&EditOptions{ |
| 2010 | IO: ios, |
| 2011 | HttpClient: func() (*http.Client, error) { |
| 2012 | return &http.Client{Transport: reg}, nil |
| 2013 | }, |
| 2014 | Detector: &fd.DisabledDetectorMock{}, |
| 2015 |