99 "regexp"
1010 "testing"
1111
12- "github.com/github/gh-cli/test"
1312 "github.com/github/gh-cli/utils"
1413)
1514
@@ -21,7 +20,7 @@ func TestIssueStatus(t *testing.T) {
2120 defer jsonFile .Close ()
2221 http .StubResponse (200 , jsonFile )
2322
24- output , err := test . RunCommand (RootCmd , "issue status" )
23+ output , err := RunCommand (issueStatusCmd , "issue status" )
2524 if err != nil {
2625 t .Errorf ("error running command `issue status`: %v" , err )
2726 }
@@ -49,7 +48,7 @@ func TestIssueList(t *testing.T) {
4948 defer jsonFile .Close ()
5049 http .StubResponse (200 , jsonFile )
5150
52- output , err := test . RunCommand (RootCmd , "issue list" )
51+ output , err := RunCommand (issueListCmd , "issue list" )
5352 if err != nil {
5453 t .Errorf ("error running command `issue list`: %v" , err )
5554 }
@@ -73,7 +72,7 @@ func TestIssueList_withFlags(t *testing.T) {
7372
7473 http .StubResponse (200 , bytes .NewBufferString (`{"data": {}}` )) // Since we are testing that the flags are passed, we don't care about the response
7574
76- _ , err := test . RunCommand (RootCmd , "issue list -a probablyCher -l web,bug -s open" )
75+ _ , err := RunCommand (issueListCmd , "issue list -a probablyCher -l web,bug -s open" )
7776 if err != nil {
7877 t .Errorf ("error running command `issue list`: %v" , err )
7978 }
@@ -108,7 +107,7 @@ func TestIssueView(t *testing.T) {
108107 })
109108 defer restoreCmd ()
110109
111- output , err := test . RunCommand (RootCmd , "issue view 8" )
110+ output , err := RunCommand (issueViewCmd , "issue view 8" )
112111 if err != nil {
113112 t .Errorf ("error running command `issue view`: %v" , err )
114113 }
@@ -141,11 +140,7 @@ func TestIssueCreate(t *testing.T) {
141140 } } } }
142141 ` ))
143142
144- out := bytes.Buffer {}
145- issueCreateCmd .SetOut (& out )
146-
147- RootCmd .SetArgs ([]string {"issue" , "create" , "-t" , "hello" , "-b" , "cash rules everything around me" })
148- _ , err := RootCmd .ExecuteC ()
143+ output , err := RunCommand (issueCreateCmd , `issue create -t hello -b "cash rules everything around me"` )
149144 if err != nil {
150145 t .Errorf ("error running command `issue create`: %v" , err )
151146 }
@@ -166,5 +161,5 @@ func TestIssueCreate(t *testing.T) {
166161 eq (t , reqBody .Variables .Input .Title , "hello" )
167162 eq (t , reqBody .Variables .Input .Body , "cash rules everything around me" )
168163
169- eq (t , out . String () , "https://github.com/OWNER/REPO/issues/12\n " )
164+ eq (t , output , "https://github.com/OWNER/REPO/issues/12\n " )
170165}
0 commit comments