(t *testing.T)
| 1941 | } |
| 1942 | |
| 1943 | func 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 | |
| 1986 | func TestIssueCreate_projectsV2(t *testing.T) { |
| 1987 | http := &httpmock.Registry{} |
nothing calls this directly
no test coverage detected