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

Function TestRunList_JSON

pkg/cmd/project/field-list/field_list_test.go:517–609  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

515}
516
517func TestRunList_JSON(t *testing.T) {
518 defer gock.Off()
519 // gock.Observe(gock.DumpRequest)
520
521 // get user ID
522 gock.New("https://api.github.com").
523 Post("/graphql").
524 MatchType("json").
525 JSON(map[string]any{
526 "query": "query UserOrgOwner.*",
527 "variables": map[string]any{
528 "login": "monalisa",
529 },
530 }).
531 Reply(200).
532 JSON(map[string]any{
533 "data": map[string]any{
534 "user": map[string]any{
535 "id": "an ID",
536 },
537 },
538 "errors": []any{
539 map[string]any{
540 "type": "NOT_FOUND",
541 "path": []string{"organization"},
542 },
543 },
544 })
545
546 // list project fields
547 gock.New("https://api.github.com").
548 Post("/graphql").
549 JSON(map[string]any{
550 "query": "query UserProject.*",
551 "variables": map[string]any{
552 "login": "monalisa",
553 "number": 1,
554 "firstItems": queries.LimitMax,
555 "afterItems": nil,
556 "firstFields": queries.LimitDefault,
557 "afterFields": nil,
558 },
559 }).
560 Reply(200).
561 JSON(map[string]any{
562 "data": map[string]any{
563 "user": map[string]any{
564 "projectV2": map[string]any{
565 "fields": map[string]any{
566 "nodes": []map[string]any{
567 {
568 "__typename": "ProjectV2Field",
569 "name": "FieldTitle",
570 "id": "field ID",
571 },
572 {
573 "__typename": "ProjectV2SingleSelectField",
574 "name": "Status",

Callers

nothing calls this directly

Calls 6

NewTestClientFunction · 0.92
TestFunction · 0.92
NewJSONExporterFunction · 0.92
ReplyMethod · 0.80
runListFunction · 0.70
StringMethod · 0.65

Tested by

no test coverage detected