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

Function Test_ProjectNamesToPaths

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

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 10

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

Tested by

no test coverage detected