MCPcopy
hub / github.com/cli/cli / TestListRun

Function TestListRun

pkg/cmd/label/list_test.go:171–393  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

169}
170
171func TestListRun(t *testing.T) {
172 tests := []struct {
173 name string
174 tty bool
175 opts *listOptions
176 httpStubs func(*httpmock.Registry)
177 wantErr bool
178 wantErrMsg string
179 wantStdout string
180 wantStderr string
181 }{
182 {
183 name: "lists labels",
184 tty: true,
185 opts: &listOptions{},
186 httpStubs: func(reg *httpmock.Registry) {
187 reg.Register(
188 httpmock.GraphQL(`query LabelList\b`),
189 httpmock.StringResponse(`
190 {
191 "data": {
192 "repository": {
193 "labels": {
194 "totalCount": 2,
195 "nodes": [
196 {
197 "name": "bug",
198 "color": "d73a4a",
199 "description": "This is a bug label"
200 },
201 {
202 "name": "docs",
203 "color": "ffa8da",
204 "description": "This is a docs label"
205 }
206 ],
207 "pageInfo": {
208 "hasNextPage": false,
209 "endCursor": "Y3Vyc29yOnYyOpK5MjAxOS0xMC0xMVQwMTozODowMyswODowMM5f3HZq"
210 }
211 }
212 }
213 }
214 }`,
215 ),
216 )
217 },
218 wantStdout: heredoc.Doc(`
219
220 Showing 2 of 2 labels in OWNER/REPO
221
222 NAME DESCRIPTION COLOR
223 bug This is a bug label #d73a4a
224 docs This is a docs label #ffa8da
225 `),
226 },
227 {
228 name: "lists labels notty",

Callers

nothing calls this directly

Calls 15

RegisterMethod · 0.95
VerifyMethod · 0.95
GraphQLFunction · 0.92
StringResponseFunction · 0.92
GraphQLQueryFunction · 0.92
TestFunction · 0.92
NewFunction · 0.92
EqualMethod · 0.80
SetStdoutTTYMethod · 0.80
SetStdinTTYMethod · 0.80
SetStderrTTYMethod · 0.80
listRunFunction · 0.70

Tested by

no test coverage detected