MCPcopy
hub / github.com/cli/cli / TestRunListTTY

Function TestRunListTTY

pkg/cmd/project/list/list_test.go:95–172  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

93}
94
95func TestRunListTTY(t *testing.T) {
96 defer gock.Off()
97 gock.Observe(gock.DumpRequest)
98 // get user ID
99 gock.New("https://api.github.com").
100 Post("/graphql").
101 MatchType("json").
102 JSON(map[string]interface{}{
103 "query": "query UserOrgOwner.*",
104 "variables": map[string]interface{}{
105 "login": "monalisa",
106 },
107 }).
108 Reply(200).
109 JSON(map[string]interface{}{
110 "data": map[string]interface{}{
111 "user": map[string]interface{}{
112 "id": "an ID",
113 },
114 },
115 "errors": []interface{}{
116 map[string]interface{}{
117 "type": "NOT_FOUND",
118 "path": []string{"organization"},
119 },
120 },
121 })
122
123 gock.New("https://api.github.com").
124 Post("/graphql").
125 Reply(200).
126 JSON(map[string]interface{}{
127 "data": map[string]interface{}{
128 "user": map[string]interface{}{
129 "login": "monalisa",
130 "projectsV2": map[string]interface{}{
131 "nodes": []interface{}{
132 map[string]interface{}{
133 "title": "Project 1",
134 "shortDescription": "Short description 1",
135 "url": "url1",
136 "closed": false,
137 "ID": "id-1",
138 "number": 1,
139 },
140 map[string]interface{}{
141 "title": "Project 2",
142 "shortDescription": "",
143 "url": "url2",
144 "closed": true,
145 "ID": "id-2",
146 "number": 2,
147 },
148 },
149 },
150 },
151 },
152 })

Callers

nothing calls this directly

Calls 7

NewTestClientFunction · 0.92
TestFunction · 0.92
ReplyMethod · 0.80
SetStdoutTTYMethod · 0.80
EqualMethod · 0.80
runListFunction · 0.70
StringMethod · 0.45

Tested by

no test coverage detected