(t *testing.T)
| 1430 | } |
| 1431 | |
| 1432 | func TestIssueCreate_AtCopilotAssignee(t *testing.T) { |
| 1433 | http := &httpmock.Registry{} |
| 1434 | defer http.Verify(t) |
| 1435 | |
| 1436 | http.Register( |
| 1437 | httpmock.GraphQL(`query IssueRepositoryInfo\b`), |
| 1438 | httpmock.StringResponse(` |
| 1439 | { "data": { "repository": { |
| 1440 | "id": "REPOID", |
| 1441 | "hasIssuesEnabled": true |
| 1442 | } } } |
| 1443 | `)) |
| 1444 | http.Register( |
| 1445 | httpmock.GraphQL(`mutation IssueCreate\b`), |
| 1446 | httpmock.GraphQLMutation(` |
| 1447 | { "data": { "createIssue": { "issue": { |
| 1448 | "id": "NEWISSUEID", |
| 1449 | "URL": "https://github.com/OWNER/REPO/issues/12" |
| 1450 | } } } } |
| 1451 | `, func(inputs map[string]interface{}) { |
| 1452 | assert.Equal(t, "hello", inputs["title"]) |
| 1453 | assert.Equal(t, "cash rules everything around me", inputs["body"]) |
| 1454 | if v, ok := inputs["assigneeIds"]; ok { |
| 1455 | t.Errorf("did not expect assigneeIds: %v", v) |
| 1456 | } |
| 1457 | })) |
| 1458 | http.Register( |
| 1459 | httpmock.GraphQL(`mutation ReplaceActorsForAssignable\b`), |
| 1460 | httpmock.GraphQLMutation(` |
| 1461 | { "data": { "replaceActorsForAssignable": { "__typename": "" } } } |
| 1462 | `, func(inputs map[string]interface{}) { |
| 1463 | assert.Equal(t, "NEWISSUEID", inputs["assignableId"]) |
| 1464 | assert.Equal(t, []interface{}{"copilot-swe-agent[bot]"}, inputs["actorLogins"]) |
| 1465 | })) |
| 1466 | |
| 1467 | output, err := runCommand(http, true, `-a @copilot -t hello -b "cash rules everything around me"`, nil) |
| 1468 | if err != nil { |
| 1469 | t.Errorf("error running command `issue create`: %v", err) |
| 1470 | } |
| 1471 | |
| 1472 | assert.Equal(t, "https://github.com/OWNER/REPO/issues/12\n", output.String()) |
| 1473 | } |
| 1474 | |
| 1475 | func TestIssueCreate_projectsV2(t *testing.T) { |
| 1476 | http := &httpmock.Registry{} |
nothing calls this directly
no test coverage detected