MCPcopy
hub / github.com/cli/cli / TestList

Function TestList

pkg/cmd/discussion/client/client_test.go:108–555  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

106}
107
108func TestList(t *testing.T) {
109 repo := ghrepo.New("OWNER", "REPO")
110
111 richNode := heredoc.Doc(`
112 {
113 "id": "D_rich1",
114 "number": 42,
115 "title": "Rich discussion",
116 "body": "body text here",
117 "url": "https://github.com/OWNER/REPO/discussions/42",
118 "closed": true,
119 "stateReason": "RESOLVED",
120 "isAnswered": true,
121 "answerChosenAt": "2024-06-01T12:00:00Z",
122 "author": {
123 "__typename": "User",
124 "login": "alice",
125 "id": "U1",
126 "name": "Alice"
127 },
128 "category": {
129 "id": "C1",
130 "name": "Q&A",
131 "slug": "q-a",
132 "emoji": ":question:",
133 "isAnswerable": true
134 },
135 "answerChosenBy": {
136 "__typename": "User",
137 "login": "bob",
138 "id": "U2",
139 "name": "Bob"
140 },
141 "labels": {
142 "nodes": [
143 {"id": "L1", "name": "bug", "color": "d73a4a"},
144 {"id": "L2", "name": "enhancement", "color": "a2eeef"}
145 ]
146 },
147 "reactionGroups": [],
148 "createdAt": "2024-01-01T00:00:00Z",
149 "updatedAt": "2024-06-02T00:00:00Z",
150 "closedAt": "2024-06-01T00:00:00Z",
151 "locked": true
152 }
153 `)
154
155 emptyResp := listResp(false, "", 0, "")
156 disabledResp := heredoc.Doc(`
157 {
158 "data": {
159 "repository": {
160 "hasDiscussionsEnabled": false,
161 "discussions": {
162 "totalCount": 0,
163 "pageInfo": {
164 "hasNextPage": false,
165 "endCursor": null

Callers

nothing calls this directly

Calls 15

RegisterMethod · 0.95
VerifyMethod · 0.95
NewFunction · 0.92
GraphQLFunction · 0.92
StringResponseFunction · 0.92
GraphQLQueryFunction · 0.92
listRespFunction · 0.85
minimalNodesFunction · 0.85
minimalNodeFunction · 0.85
newTestDiscussionClientFunction · 0.85
EqualMethod · 0.80
ContainsMethod · 0.80

Tested by

no test coverage detected