(t *testing.T)
| 1379 | } |
| 1380 | |
| 1381 | func TestIssueCreate_AtMeAssignee(t *testing.T) { |
| 1382 | http := &httpmock.Registry{} |
| 1383 | defer http.Verify(t) |
| 1384 | |
| 1385 | http.Register( |
| 1386 | httpmock.GraphQL(`query UserCurrent\b`), |
| 1387 | httpmock.StringResponse(` |
| 1388 | { "data": { |
| 1389 | "viewer": { "login": "MonaLisa" } |
| 1390 | } } |
| 1391 | `), |
| 1392 | ) |
| 1393 | http.Register( |
| 1394 | httpmock.GraphQL(`query IssueRepositoryInfo\b`), |
| 1395 | httpmock.StringResponse(` |
| 1396 | { "data": { "repository": { |
| 1397 | "id": "REPOID", |
| 1398 | "hasIssuesEnabled": true |
| 1399 | } } } |
| 1400 | `)) |
| 1401 | http.Register( |
| 1402 | httpmock.GraphQL(`mutation IssueCreate\b`), |
| 1403 | httpmock.GraphQLMutation(` |
| 1404 | { "data": { "createIssue": { "issue": { |
| 1405 | "id": "NEWISSUEID", |
| 1406 | "URL": "https://github.com/OWNER/REPO/issues/12" |
| 1407 | } } } } |
| 1408 | `, func(inputs map[string]interface{}) { |
| 1409 | assert.Equal(t, "hello", inputs["title"]) |
| 1410 | assert.Equal(t, "cash rules everything around me", inputs["body"]) |
| 1411 | if v, ok := inputs["assigneeIds"]; ok { |
| 1412 | t.Errorf("did not expect assigneeIds: %v", v) |
| 1413 | } |
| 1414 | })) |
| 1415 | http.Register( |
| 1416 | httpmock.GraphQL(`mutation ReplaceActorsForAssignable\b`), |
| 1417 | httpmock.GraphQLMutation(` |
| 1418 | { "data": { "replaceActorsForAssignable": { "__typename": "" } } } |
| 1419 | `, func(inputs map[string]interface{}) { |
| 1420 | assert.Equal(t, "NEWISSUEID", inputs["assignableId"]) |
| 1421 | assert.Equal(t, []interface{}{"MonaLisa", "someoneelse"}, inputs["actorLogins"]) |
| 1422 | })) |
| 1423 | |
| 1424 | output, err := runCommand(http, true, `-a @me -a someoneelse -t hello -b "cash rules everything around me"`, nil) |
| 1425 | if err != nil { |
| 1426 | t.Errorf("error running command `issue create`: %v", err) |
| 1427 | } |
| 1428 | |
| 1429 | assert.Equal(t, "https://github.com/OWNER/REPO/issues/12\n", output.String()) |
| 1430 | } |
| 1431 | |
| 1432 | func TestIssueCreate_AtCopilotAssignee(t *testing.T) { |
| 1433 | http := &httpmock.Registry{} |
nothing calls this directly
no test coverage detected