(t *testing.T)
| 1831 | } |
| 1832 | |
| 1833 | func TestIssueCreate_AtMeAssignee(t *testing.T) { |
| 1834 | http := &httpmock.Registry{} |
| 1835 | defer http.Verify(t) |
| 1836 | |
| 1837 | http.Register( |
| 1838 | httpmock.GraphQL(`query UserCurrent\b`), |
| 1839 | httpmock.StringResponse(` |
| 1840 | { "data": { |
| 1841 | "viewer": { "login": "MonaLisa" } |
| 1842 | } } |
| 1843 | `), |
| 1844 | ) |
| 1845 | http.Register( |
| 1846 | httpmock.GraphQL(`query IssueRepositoryInfo\b`), |
| 1847 | httpmock.StringResponse(` |
| 1848 | { "data": { "repository": { |
| 1849 | "id": "REPOID", |
| 1850 | "hasIssuesEnabled": true |
| 1851 | } } } |
| 1852 | `)) |
| 1853 | http.Register( |
| 1854 | httpmock.GraphQL(`mutation IssueCreate\b`), |
| 1855 | httpmock.GraphQLMutation(` |
| 1856 | { "data": { "createIssue": { "issue": { |
| 1857 | "id": "NEWISSUEID", |
| 1858 | "URL": "https://github.com/OWNER/REPO/issues/12" |
| 1859 | } } } } |
| 1860 | `, func(inputs map[string]any) { |
| 1861 | assert.Equal(t, "hello", inputs["title"]) |
| 1862 | assert.Equal(t, "cash rules everything around me", inputs["body"]) |
| 1863 | if v, ok := inputs["assigneeIds"]; ok { |
| 1864 | t.Errorf("did not expect assigneeIds: %v", v) |
| 1865 | } |
| 1866 | })) |
| 1867 | http.Register( |
| 1868 | httpmock.GraphQL(`mutation ReplaceActorsForAssignable\b`), |
| 1869 | httpmock.GraphQLMutation(` |
| 1870 | { "data": { "replaceActorsForAssignable": { "__typename": "" } } } |
| 1871 | `, func(inputs map[string]any) { |
| 1872 | assert.Equal(t, "NEWISSUEID", inputs["assignableId"]) |
| 1873 | assert.Equal(t, []any{"MonaLisa", "someoneelse"}, inputs["actorLogins"]) |
| 1874 | })) |
| 1875 | |
| 1876 | output, err := runCommand(http, true, `-a @me -a someoneelse -t hello -b "cash rules everything around me"`, nil) |
| 1877 | if err != nil { |
| 1878 | t.Errorf("error running command `issue create`: %v", err) |
| 1879 | } |
| 1880 | |
| 1881 | assert.Equal(t, "https://github.com/OWNER/REPO/issues/12\n", output.String()) |
| 1882 | } |
| 1883 | |
| 1884 | func TestIssueCreate_AtCopilotAssignee(t *testing.T) { |
| 1885 | http := &httpmock.Registry{} |
nothing calls this directly
no test coverage detected