MCPcopy
hub / github.com/cli/cli / TestIssueCreate_AtCopilotAssignee

Function TestIssueCreate_AtCopilotAssignee

pkg/cmd/issue/create/create_test.go:1432–1473  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1430}
1431
1432func 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
1475func TestIssueCreate_projectsV2(t *testing.T) {
1476 http := &httpmock.Registry{}

Callers

nothing calls this directly

Calls 9

VerifyMethod · 0.95
RegisterMethod · 0.95
GraphQLFunction · 0.92
StringResponseFunction · 0.92
GraphQLMutationFunction · 0.92
EqualMethod · 0.80
runCommandFunction · 0.70
ErrorfMethod · 0.65
StringMethod · 0.45

Tested by

no test coverage detected