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

Function TestRunViewWeb_Me

pkg/cmd/project/view/view_test.go:457–530  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

455}
456
457func TestRunViewWeb_Me(t *testing.T) {
458 defer gock.Off()
459 gock.Observe(gock.DumpRequest)
460 // get viewer ID
461 gock.New("https://api.github.com").
462 Post("/graphql").
463 MatchType("json").
464 JSON(map[string]interface{}{
465 "query": "query Viewer.*",
466 }).
467 Reply(200).
468 JSON(map[string]interface{}{
469 "data": map[string]interface{}{
470 "viewer": map[string]interface{}{
471 "id": "an ID",
472 "login": "theviewer",
473 },
474 },
475 })
476
477 gock.New("https://api.github.com").
478 Post("/graphql").
479 MatchType("json").
480 JSON(map[string]interface{}{
481 "query": "query ViewerProject.*",
482 "variables": map[string]interface{}{"afterFields": nil, "afterItems": nil, "firstFields": 100, "firstItems": 0, "number": 8},
483 }).
484 Reply(200).
485 JSON(`
486 {"data":
487 {"viewer":
488 {
489 "login":"github",
490 "projectV2": {
491 "number": 8,
492 "items": {
493 "totalCount": 10
494 },
495 "readme": null,
496 "url": "https://github.com/users/theviewer/projects/8",
497 "fields": {
498 "nodes": [
499 {
500 "name": "Title"
501 }
502 ]
503 }
504 }
505 }
506 }
507 }
508 `)
509
510 client := queries.NewTestClient()
511 buf := bytes.Buffer{}
512 ios, _, _, _ := iostreams.Test()
513 config := viewConfig{
514 opts: viewOpts{

Callers

nothing calls this directly

Calls 6

NewTestClientFunction · 0.92
TestFunction · 0.92
ReplyMethod · 0.80
EqualMethod · 0.80
runViewFunction · 0.70
StringMethod · 0.45

Tested by

no test coverage detected