TODO projectsV1Deprecation Remove this test.
(t *testing.T)
| 2180 | // TODO projectsV1Deprecation |
| 2181 | // Remove this test. |
| 2182 | func TestProjectsV1Deprecation(t *testing.T) { |
| 2183 | t.Run("when projects v1 is supported, is included in query", func(t *testing.T) { |
| 2184 | ios, _, _, _ := iostreams.Test() |
| 2185 | |
| 2186 | reg := &httpmock.Registry{} |
| 2187 | reg.Register( |
| 2188 | httpmock.GraphQL(`projectCards`), |
| 2189 | // Simulate a GraphQL error to early exit the test. |
| 2190 | httpmock.StatusStringResponse(500, ""), |
| 2191 | ) |
| 2192 | |
| 2193 | _, cmdTeardown := run.Stub() |
| 2194 | defer cmdTeardown(t) |
| 2195 | |
| 2196 | // Ignore the error because we have no way to really stub it without |
| 2197 | // fully stubbing a GQL error structure in the request body. |
| 2198 | _ = editRun(&EditOptions{ |
| 2199 | IO: ios, |
| 2200 | HttpClient: func() (*http.Client, error) { |
| 2201 | return &http.Client{Transport: reg}, nil |
| 2202 | }, |
| 2203 | BaseRepo: func() (ghrepo.Interface, error) { |
| 2204 | return ghrepo.New("OWNER", "REPO"), nil |
| 2205 | }, |
| 2206 | Detector: &fd.EnabledDetectorMock{}, |
| 2207 | |
| 2208 | IssueNumbers: []int{123}, |
| 2209 | Editable: prShared.Editable{ |
| 2210 | Projects: prShared.EditableProjects{ |
| 2211 | EditableSlice: prShared.EditableSlice{ |
| 2212 | Add: []string{"Test Project"}, |
| 2213 | Edited: true, |
| 2214 | }, |
| 2215 | }, |
| 2216 | }, |
| 2217 | }) |
| 2218 | |
| 2219 | // Verify that our request contained projectCards |
| 2220 | reg.Verify(t) |
| 2221 | }) |
| 2222 | |
| 2223 | t.Run("when projects v1 is not supported, is not included in query", func(t *testing.T) { |
| 2224 | ios, _, _, _ := iostreams.Test() |
| 2225 | |
| 2226 | reg := &httpmock.Registry{} |
| 2227 | reg.Exclude(t, httpmock.GraphQL(`projectCards`)) |
| 2228 | |
| 2229 | reg.Register( |
| 2230 | httpmock.GraphQL(`.*`), |
| 2231 | // Simulate a GraphQL error to early exit the test. |
| 2232 | httpmock.StatusStringResponse(500, ""), |
| 2233 | ) |
| 2234 | |
| 2235 | _, cmdTeardown := run.Stub() |
| 2236 | defer cmdTeardown(t) |
| 2237 | |
| 2238 | // Ignore the error because we're not really interested in it. |
| 2239 | _ = editRun(&EditOptions{ |