(t *testing.T)
| 169 | } |
| 170 | |
| 171 | func 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", |
nothing calls this directly
no test coverage detected