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

Function TestIssueCreate_AtMeAssignee

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

Source from the content-addressed store, hash-verified

1831}
1832
1833func 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
1884func TestIssueCreate_AtCopilotAssignee(t *testing.T) {
1885 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