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