MCPcopy Create free account
hub / github.com/cli/cli / TestIssueCreate_AtCopilotAssignee

Function TestIssueCreate_AtCopilotAssignee

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

Source from the content-addressed store, hash-verified

1941}
1942
1943func TestIssueCreate_AtCopilotAssignee(t *testing.T) {
1944 http := &httpmock.Registry{}
1945 defer http.Verify(t)
1946
1947 http.Register(
1948 httpmock.GraphQL(`query IssueRepositoryInfo\b`),
1949 httpmock.StringResponse(`
1950 { "data": { "repository": {
1951 "id": "REPOID",
1952 "hasIssuesEnabled": true
1953 } } }
1954 `))
1955 http.Register(
1956 httpmock.GraphQL(`mutation IssueCreate\b`),
1957 httpmock.GraphQLMutation(`
1958 { "data": { "createIssue": { "issue": {
1959 "id": "NEWISSUEID",
1960 "URL": "https://github.com/OWNER/REPO/issues/12"
1961 } } } }
1962 `, func(inputs map[string]any) {
1963 assert.Equal(t, "hello", inputs["title"])
1964 assert.Equal(t, "cash rules everything around me", inputs["body"])
1965 if v, ok := inputs["assigneeIds"]; ok {
1966 t.Errorf("did not expect assigneeIds: %v", v)
1967 }
1968 }))
1969 http.Register(
1970 httpmock.GraphQL(`mutation ReplaceActorsForAssignable\b`),
1971 httpmock.GraphQLMutation(`
1972 { "data": { "replaceActorsForAssignable": { "__typename": "" } } }
1973 `, func(inputs map[string]any) {
1974 assert.Equal(t, "NEWISSUEID", inputs["assignableId"])
1975 assert.Equal(t, []any{"copilot-swe-agent[bot]"}, inputs["actorLogins"])
1976 }))
1977
1978 output, err := runCommand(http, true, `-a @copilot -t hello -b "cash rules everything around me"`, nil)
1979 if err != nil {
1980 t.Errorf("error running command `issue create`: %v", err)
1981 }
1982
1983 assert.Equal(t, "https://github.com/OWNER/REPO/issues/12\n", output.String())
1984}
1985
1986func TestIssueCreate_projectsV2(t *testing.T) {
1987 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.65

Tested by

no test coverage detected