MCPcopy Create free account
hub / github.com/cli/cli / Test_ProjectNamesToPaths

Function Test_ProjectNamesToPaths

api/queries_repo_test.go:504–668  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

502}
503
504func Test_ProjectNamesToPaths(t *testing.T) {
505 t.Run("when projectsV1 is supported, requests them", func(t *testing.T) {
506 http := &httpmock.Registry{}
507 client := newTestClient(http)
508
509 repo, _ := ghrepo.FromFullName("OWNER/REPO")
510
511 http.Register(
512 httpmock.GraphQL(`query RepositoryProjectList\b`),
513 httpmock.StringResponse(`
514 { "data": { "repository": { "projects": {
515 "nodes": [
516 { "name": "Cleanup", "id": "CLEANUPID", "resourcePath": "/OWNER/REPO/projects/1" },
517 { "name": "Roadmap", "id": "ROADMAPID", "resourcePath": "/OWNER/REPO/projects/2" }
518 ],
519 "pageInfo": { "hasNextPage": false }
520 } } } }
521 `))
522 http.Register(
523 httpmock.GraphQL(`query OrganizationProjectList\b`),
524 httpmock.StringResponse(`
525 { "data": { "organization": { "projects": {
526 "nodes": [
527 { "name": "Triage", "id": "TRIAGEID", "resourcePath": "/orgs/ORG/projects/1" }
528 ],
529 "pageInfo": { "hasNextPage": false }
530 } } } }
531 `))
532 http.Register(
533 httpmock.GraphQL(`query RepositoryProjectV2List\b`),
534 httpmock.StringResponse(`
535 { "data": { "repository": { "projectsV2": {
536 "nodes": [
537 { "title": "CleanupV2", "id": "CLEANUPV2ID", "resourcePath": "/OWNER/REPO/projects/3" },
538 { "title": "RoadmapV2", "id": "ROADMAPV2ID", "resourcePath": "/OWNER/REPO/projects/4" }
539 ],
540 "pageInfo": { "hasNextPage": false }
541 } } } }
542 `))
543 http.Register(
544 httpmock.GraphQL(`query OrganizationProjectV2List\b`),
545 httpmock.StringResponse(`
546 { "data": { "organization": { "projectsV2": {
547 "nodes": [
548 { "title": "TriageV2", "id": "TRIAGEV2ID", "resourcePath": "/orgs/ORG/projects/2" }
549 ],
550 "pageInfo": { "hasNextPage": false }
551 } } } }
552 `))
553 http.Register(
554 httpmock.GraphQL(`query UserProjectV2List\b`),
555 httpmock.StringResponse(`
556 { "data": { "viewer": { "projectsV2": {
557 "nodes": [
558 { "title": "MonalisaV2", "id": "MONALISAV2ID", "resourcePath": "/users/MONALISA/projects/5" }
559 ],
560 "pageInfo": { "hasNextPage": false }
561 } } } }

Callers

nothing calls this directly

Calls 10

RegisterMethod · 0.95
ExcludeMethod · 0.95
FromFullNameFunction · 0.92
GraphQLFunction · 0.92
StringResponseFunction · 0.92
newTestClientFunction · 0.85
ProjectTitlesToPathsFunction · 0.85
EqualMethod · 0.80
RunMethod · 0.65
ErrorfMethod · 0.65

Tested by

no test coverage detected