MCPcopy Create free account
hub / github.com/cli/cli / TestIssueCreate_AtMeAssignee

Function TestIssueCreate_AtMeAssignee

pkg/cmd/issue/create/create_test.go:1892–1941  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1890}
1891
1892func 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
1943func TestIssueCreate_AtCopilotAssignee(t *testing.T) {
1944 http := &httpmock.Registry{}

Callers

nothing calls this directly

Calls 9

VerifyMethod · 0.95
RegisterMethod · 0.95
GraphQLFunction · 0.92
StringResponseFunction · 0.92
GraphQLMutationFunction · 0.92
EqualMethod · 0.80
runCommandFunction · 0.70
ErrorfMethod · 0.65
StringMethod · 0.65

Tested by

no test coverage detected