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

Function TestLabelList_pagination

pkg/cmd/label/http_test.go:12–80  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

10)
11
12func TestLabelList_pagination(t *testing.T) {
13 reg := &httpmock.Registry{}
14 client := &http.Client{Transport: reg}
15
16 reg.Register(
17 httpmock.GraphQL(`query LabelList\b`),
18 httpmock.StringResponse(`
19 {
20 "data": {
21 "repository": {
22 "labels": {
23 "totalCount": 2,
24 "nodes": [
25 {
26 "name": "bug",
27 "color": "d73a4a",
28 "description": "This is a bug label"
29 }
30 ],
31 "pageInfo": {
32 "hasNextPage": true,
33 "endCursor": "Y3Vyc29yOnYyOpK5MjAxOS0xMC0xMVQwMTozODowMyswODowMM5f3HZq"
34 }
35 }
36 }
37 }
38 }`),
39 )
40
41 reg.Register(
42 httpmock.GraphQL(`query LabelList\b`),
43 httpmock.StringResponse(`
44 {
45 "data": {
46 "repository": {
47 "labels": {
48 "totalCount": 2,
49 "nodes": [
50 {
51 "name": "docs",
52 "color": "ffa8da",
53 "description": "This is a docs label"
54 }
55 ],
56 "pageInfo": {
57 "hasNextPage": false,
58 "endCursor": "Y3Vyc29yOnYyOpK5MjAyMi0wMS0zMVQxODo1NTo1MiswODowMM7hiAL3"
59 }
60 }
61 }
62 }
63 }`),
64 )
65
66 repo := ghrepo.New("OWNER", "REPO")
67 labels, totalCount, err := listLabels(client, repo, listQueryOptions{Limit: 10})
68 assert.NoError(t, err)
69

Callers

nothing calls this directly

Calls 6

RegisterMethod · 0.95
GraphQLFunction · 0.92
StringResponseFunction · 0.92
NewFunction · 0.92
listLabelsFunction · 0.85
EqualMethod · 0.80

Tested by

no test coverage detected