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

Function TestIssueCreate_AtCopilotAssignee

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

Source from the content-addressed store, hash-verified

1924}
1925
1926func TestIssueCreate_AtCopilotAssignee(t *testing.T) {
1927 http := &httpmock.Registry{}
1928 defer http.Verify(t)
1929
1930 http.Register(
1931 httpmock.GraphQL(`query IssueRepositoryInfo\b`),
1932 httpmock.StringResponse(`
1933 { "data": { "repository": {
1934 "id": "REPOID",
1935 "hasIssuesEnabled": true
1936 } } }
1937 `))
1938 http.Register(
1939 httpmock.GraphQL(`mutation IssueCreate\b`),
1940 httpmock.GraphQLMutation(`
1941 { "data": { "createIssue": { "issue": {
1942 "id": "NEWISSUEID",
1943 "URL": "https://github.com/OWNER/REPO/issues/12"
1944 } } } }
1945 `, func(inputs map[string]any) {
1946 assert.Equal(t, "hello", inputs["title"])
1947 assert.Equal(t, "cash rules everything around me", inputs["body"])
1948 if v, ok := inputs["assigneeIds"]; ok {
1949 t.Errorf("did not expect assigneeIds: %v", v)
1950 }
1951 }))
1952 http.Register(
1953 httpmock.GraphQL(`mutation ReplaceActorsForAssignable\b`),
1954 httpmock.GraphQLMutation(`
1955 { "data": { "replaceActorsForAssignable": { "__typename": "" } } }
1956 `, func(inputs map[string]any) {
1957 assert.Equal(t, "NEWISSUEID", inputs["assignableId"])
1958 assert.Equal(t, []any{"copilot-swe-agent[bot]"}, inputs["actorLogins"])
1959 }))
1960
1961 output, err := runCommand(http, true, `-a @copilot -t hello -b "cash rules everything around me"`, nil)
1962 if err != nil {
1963 t.Errorf("error running command `issue create`: %v", err)
1964 }
1965
1966 assert.Equal(t, "https://github.com/OWNER/REPO/issues/12\n", output.String())
1967}
1968
1969func TestIssueCreate_projectsV2(t *testing.T) {
1970 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