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