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