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