(t *testing.T)
| 1882 | } |
| 1883 | |
| 1884 | func TestIssueCreate_AtCopilotAssignee(t *testing.T) { |
| 1885 | http := &httpmock.Registry{} |
| 1886 | defer http.Verify(t) |
| 1887 | |
| 1888 | http.Register( |
| 1889 | httpmock.GraphQL(`query IssueRepositoryInfo\b`), |
| 1890 | httpmock.StringResponse(` |
| 1891 | { "data": { "repository": { |
| 1892 | "id": "REPOID", |
| 1893 | "hasIssuesEnabled": true |
| 1894 | } } } |
| 1895 | `)) |
| 1896 | http.Register( |
| 1897 | httpmock.GraphQL(`mutation IssueCreate\b`), |
| 1898 | httpmock.GraphQLMutation(` |
| 1899 | { "data": { "createIssue": { "issue": { |
| 1900 | "id": "NEWISSUEID", |
| 1901 | "URL": "https://github.com/OWNER/REPO/issues/12" |
| 1902 | } } } } |
| 1903 | `, func(inputs map[string]any) { |
| 1904 | assert.Equal(t, "hello", inputs["title"]) |
| 1905 | assert.Equal(t, "cash rules everything around me", inputs["body"]) |
| 1906 | if v, ok := inputs["assigneeIds"]; ok { |
| 1907 | t.Errorf("did not expect assigneeIds: %v", v) |
| 1908 | } |
| 1909 | })) |
| 1910 | http.Register( |
| 1911 | httpmock.GraphQL(`mutation ReplaceActorsForAssignable\b`), |
| 1912 | httpmock.GraphQLMutation(` |
| 1913 | { "data": { "replaceActorsForAssignable": { "__typename": "" } } } |
| 1914 | `, func(inputs map[string]any) { |
| 1915 | assert.Equal(t, "NEWISSUEID", inputs["assignableId"]) |
| 1916 | assert.Equal(t, []any{"copilot-swe-agent[bot]"}, inputs["actorLogins"]) |
| 1917 | })) |
| 1918 | |
| 1919 | output, err := runCommand(http, true, `-a @copilot -t hello -b "cash rules everything around me"`, nil) |
| 1920 | if err != nil { |
| 1921 | t.Errorf("error running command `issue create`: %v", err) |
| 1922 | } |
| 1923 | |
| 1924 | assert.Equal(t, "https://github.com/OWNER/REPO/issues/12\n", output.String()) |
| 1925 | } |
| 1926 | |
| 1927 | func TestIssueCreate_projectsV2(t *testing.T) { |
| 1928 | http := &httpmock.Registry{} |
nothing calls this directly
no test coverage detected