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

Function TestIssueCreate_AtCopilotAssignee

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

Source from the content-addressed store, hash-verified

1882}
1883
1884func 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
1927func TestIssueCreate_projectsV2(t *testing.T) {
1928 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