MCPcopy Index your code
hub / github.com/cli/cli / TestPRList_withProjectItems

Function TestPRList_withProjectItems

pkg/cmd/pr/list/list_test.go:335–407  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

333}
334
335func TestPRList_withProjectItems(t *testing.T) {
336 reg := &httpmock.Registry{}
337 defer reg.Verify(t)
338
339 reg.Register(
340 httpmock.GraphQL(`query PullRequestList\b`),
341 httpmock.GraphQLQuery(`{
342 "data": {
343 "repository": {
344 "pullRequests": {
345 "totalCount": 1,
346 "nodes": [
347 {
348 "projectItems": {
349 "nodes": [
350 {
351 "id": "PVTI_lAHOAA3WC84AW6WNzgJ8rnQ",
352 "project": {
353 "id": "PVT_kwHOAA3WC84AW6WN",
354 "title": "Test Public Project"
355 },
356 "status": {
357 "optionId": "47fc9ee4",
358 "name": "In Progress"
359 }
360 }
361 ],
362 "totalCount": 1
363 }
364 }
365 ]
366 }
367 }
368 }
369 }`, func(_ string, params map[string]interface{}) {
370 require.Equal(t, map[string]interface{}{
371 "owner": "OWNER",
372 "repo": "REPO",
373 "limit": float64(30),
374 "state": []interface{}{"OPEN"},
375 }, params)
376 }))
377
378 client := &http.Client{Transport: reg}
379 prsAndTotalCount, err := listPullRequests(
380 client,
381 nil,
382 ghrepo.New("OWNER", "REPO"),
383 prShared.FilterOptions{
384 Entity: "pr",
385 State: "open",
386 },
387 30,
388 )
389
390 require.NoError(t, err)
391 require.Len(t, prsAndTotalCount.PullRequests, 1)
392 require.Len(t, prsAndTotalCount.PullRequests[0].ProjectItems.Nodes, 1)

Callers

nothing calls this directly

Calls 8

VerifyMethod · 0.95
RegisterMethod · 0.95
GraphQLFunction · 0.92
GraphQLQueryFunction · 0.92
NewFunction · 0.92
listPullRequestsFunction · 0.85
EqualMethod · 0.80
LenMethod · 0.65

Tested by

no test coverage detected