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

Function TestPRList_Search_withProjectItems

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

Source from the content-addressed store, hash-verified

407}
408
409func TestPRList_Search_withProjectItems(t *testing.T) {
410 reg := &httpmock.Registry{}
411 defer reg.Verify(t)
412
413 reg.Register(
414 httpmock.GraphQL(`query PullRequestSearch\b`),
415 httpmock.GraphQLQuery(`{
416 "data": {
417 "search": {
418 "issueCount": 1,
419 "nodes": [
420 {
421 "projectItems": {
422 "nodes": [
423 {
424 "id": "PVTI_lAHOAA3WC84AW6WNzgJ8rl0",
425 "project": {
426 "id": "PVT_kwHOAA3WC84AW6WN",
427 "title": "Test Public Project"
428 },
429 "status": {
430 "optionId": "47fc9ee4",
431 "name": "In Progress"
432 }
433 }
434 ],
435 "totalCount": 1
436 }
437 }
438 ]
439 }
440 }
441 }`, func(_ string, params map[string]interface{}) {
442 require.Equal(t, map[string]interface{}{
443 "limit": float64(30),
444 "q": "( just used to force the search API branch ) repo:OWNER/REPO state:open type:pr",
445 "type": "ISSUE_ADVANCED",
446 }, params)
447 }))
448
449 client := &http.Client{Transport: reg}
450 prsAndTotalCount, err := listPullRequests(
451 client,
452 // TODO advancedIssueSearchCleanup
453 // No need for feature detection once GHES 3.17 support ends.
454 fd.AdvancedIssueSearchSupportedAsOptIn(),
455 ghrepo.New("OWNER", "REPO"),
456 prShared.FilterOptions{
457 Entity: "pr",
458 State: "open",
459 Search: "just used to force the search API branch",
460 },
461 30,
462 )
463
464 require.NoError(t, err)
465 require.Len(t, prsAndTotalCount.PullRequests, 1)
466 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