(t *testing.T)
| 1924 | } |
| 1925 | |
| 1926 | func 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 | |
| 1969 | func TestIssueCreate_projectsV2(t *testing.T) { |
| 1970 | http := &httpmock.Registry{} |
nothing calls this directly
no test coverage detected