MCPcopy
hub / github.com/cli/cli / Test_ProjectNamesToPaths

Function Test_ProjectNamesToPaths

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

Source from the content-addressed store, hash-verified

419}
420
421func Test_ProjectNamesToPaths(t *testing.T) {
422 t.Run("when projectsV1 is supported, requests them", func(t *testing.T) {
423 http := &httpmock.Registry{}
424 client := newTestClient(http)
425
426 repo, _ := ghrepo.FromFullName("OWNER/REPO")
427
428 http.Register(
429 httpmock.GraphQL(`query RepositoryProjectList\b`),
430 httpmock.StringResponse(`
431 { "data": { "repository": { "projects": {
432 "nodes": [
433 { "name": "Cleanup", "id": "CLEANUPID", "resourcePath": "/OWNER/REPO/projects/1" },
434 { "name": "Roadmap", "id": "ROADMAPID", "resourcePath": "/OWNER/REPO/projects/2" }
435 ],
436 "pageInfo": { "hasNextPage": false }
437 } } } }
438 `))
439 http.Register(
440 httpmock.GraphQL(`query OrganizationProjectList\b`),
441 httpmock.StringResponse(`
442 { "data": { "organization": { "projects": {
443 "nodes": [
444 { "name": "Triage", "id": "TRIAGEID", "resourcePath": "/orgs/ORG/projects/1" }
445 ],
446 "pageInfo": { "hasNextPage": false }
447 } } } }
448 `))
449 http.Register(
450 httpmock.GraphQL(`query RepositoryProjectV2List\b`),
451 httpmock.StringResponse(`
452 { "data": { "repository": { "projectsV2": {
453 "nodes": [
454 { "title": "CleanupV2", "id": "CLEANUPV2ID", "resourcePath": "/OWNER/REPO/projects/3" },
455 { "title": "RoadmapV2", "id": "ROADMAPV2ID", "resourcePath": "/OWNER/REPO/projects/4" }
456 ],
457 "pageInfo": { "hasNextPage": false }
458 } } } }
459 `))
460 http.Register(
461 httpmock.GraphQL(`query OrganizationProjectV2List\b`),
462 httpmock.StringResponse(`
463 { "data": { "organization": { "projectsV2": {
464 "nodes": [
465 { "title": "TriageV2", "id": "TRIAGEV2ID", "resourcePath": "/orgs/ORG/projects/2" }
466 ],
467 "pageInfo": { "hasNextPage": false }
468 } } } }
469 `))
470 http.Register(
471 httpmock.GraphQL(`query UserProjectV2List\b`),
472 httpmock.StringResponse(`
473 { "data": { "viewer": { "projectsV2": {
474 "nodes": [
475 { "title": "MonalisaV2", "id": "MONALISAV2ID", "resourcePath": "/users/MONALISA/projects/5" }
476 ],
477 "pageInfo": { "hasNextPage": false }
478 } } } }

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