(t *testing.T)
| 218 | } |
| 219 | |
| 220 | func Test_runLock(t *testing.T) { |
| 221 | cases := []struct { |
| 222 | name string |
| 223 | opts LockOptions |
| 224 | promptStubs func(*testing.T, *prompter.PrompterMock) |
| 225 | httpStubs func(*testing.T, *httpmock.Registry) |
| 226 | wantOut string |
| 227 | wantErrOut string |
| 228 | wantErr string |
| 229 | tty bool |
| 230 | state string |
| 231 | }{ |
| 232 | { |
| 233 | name: "lock issue nontty", |
| 234 | state: Lock, |
| 235 | opts: LockOptions{ |
| 236 | IssueNumber: 451, |
| 237 | ParentCmd: "issue", |
| 238 | }, |
| 239 | httpStubs: func(t *testing.T, reg *httpmock.Registry) { |
| 240 | reg.Register( |
| 241 | httpmock.GraphQL(`query IssueByNumber\b`), |
| 242 | httpmock.StringResponse(` |
| 243 | { "data": { "repository": { "hasIssuesEnabled": true, "issue": { |
| 244 | "number": 451, |
| 245 | "__typename": "Issue" }}}}`)) |
| 246 | reg.Register( |
| 247 | httpmock.GraphQL(`mutation LockLockable\b`), |
| 248 | httpmock.StringResponse(` |
| 249 | { "data": { |
| 250 | "lockLockable": { |
| 251 | "lockedRecord": { |
| 252 | "locked": true }}}}`)) |
| 253 | }, |
| 254 | }, |
| 255 | { |
| 256 | name: "lock issue tty", |
| 257 | tty: true, |
| 258 | opts: LockOptions{ |
| 259 | Interactive: true, |
| 260 | IssueNumber: 451, |
| 261 | ParentCmd: "issue", |
| 262 | }, |
| 263 | state: Lock, |
| 264 | httpStubs: func(t *testing.T, reg *httpmock.Registry) { |
| 265 | reg.Register( |
| 266 | httpmock.GraphQL(`query IssueByNumber\b`), |
| 267 | httpmock.StringResponse(` |
| 268 | { "data": { "repository": { "hasIssuesEnabled": true, "issue": { |
| 269 | "number": 451, |
| 270 | "title": "traverse the library", |
| 271 | "__typename": "Issue" }}}}`)) |
| 272 | reg.Register( |
| 273 | httpmock.GraphQL(`mutation LockLockable\b`), |
| 274 | httpmock.StringResponse(` |
| 275 | { "data": { |
| 276 | "lockLockable": { |
| 277 | "lockedRecord": { |
nothing calls this directly
no test coverage detected