@@ -13,7 +13,7 @@ func TestPRReview_validation(t *testing.T) {
1313 for _ , cmd := range []string {
1414 `pr review 123` ,
1515 `pr review --approve --comment 123` ,
16- `pr review --approve="cool" --comment="rad " 123` ,
16+ `pr review --approve --comment -b"hey " 123` ,
1717 } {
1818 http .StubRepoResponse ("OWNER" , "REPO" )
1919 _ , err := RunCommand (cmd )
@@ -89,7 +89,7 @@ func TestPRReview_number_arg(t *testing.T) {
8989 } } } } ` ))
9090 http .StubResponse (200 , bytes .NewBufferString (`{"data": {} }` ))
9191
92- _ , err := RunCommand ("pr review --request-changes 123" )
92+ _ , err := RunCommand ("pr review --approve 123" )
9393 if err != nil {
9494 t .Fatalf ("error running pr review: %s" , err )
9595 }
@@ -107,7 +107,7 @@ func TestPRReview_number_arg(t *testing.T) {
107107 _ = json .Unmarshal (bodyBytes , & reqBody )
108108
109109 eq (t , reqBody .Variables .Input .PullRequestID , "foobar123" )
110- eq (t , reqBody .Variables .Input .Event , "REQUEST_CHANGES " )
110+ eq (t , reqBody .Variables .Input .Event , "APPROVE " )
111111 eq (t , reqBody .Variables .Input .Body , "" )
112112}
113113
@@ -121,11 +121,10 @@ func TestPRReview_no_arg(t *testing.T) {
121121 "id": "foobar123",
122122 "headRefName": "feature",
123123 "baseRefName": "master" }
124- ] } } } }
125- ` ))
124+ ] } } } }` ))
126125 http .StubResponse (200 , bytes .NewBufferString (`{"data": {} }` ))
127126
128- _ , err := RunCommand (`pr review --comment= "cool story"` )
127+ _ , err := RunCommand (`pr review --comment -b "cool story"` )
129128 if err != nil {
130129 t .Fatalf ("error running pr review: %s" , err )
131130 }
@@ -153,7 +152,16 @@ func TestPRReview_blank_comment(t *testing.T) {
153152 http .StubRepoResponse ("OWNER" , "REPO" )
154153
155154 _ , err := RunCommand (`pr review --comment 123` )
156- eq (t , err .Error (), "did not understand desired review action: cannot leave blank comment" )
155+ eq (t , err .Error (), "did not understand desired review action: body cannot be blank for comment review" )
156+ }
157+
158+ func TestPRReview_blank_request_changes (t * testing.T ) {
159+ initBlankContext ("" , "OWNER/REPO" , "master" )
160+ http := initFakeHTTP ()
161+ http .StubRepoResponse ("OWNER" , "REPO" )
162+
163+ _ , err := RunCommand (`pr review -r 123` )
164+ eq (t , err .Error (), "did not understand desired review action: body cannot be blank for request-changes review" )
157165}
158166
159167func TestPRReview (t * testing.T ) {
@@ -163,11 +171,10 @@ func TestPRReview(t *testing.T) {
163171 ExpectedBody string
164172 }
165173 cases := []c {
166- c {`pr review --request-changes="bad"` , "REQUEST_CHANGES" , "bad" },
167- c {`pr review --request-changes` , "REQUEST_CHANGES" , "" },
174+ c {`pr review --request-changes -b"bad"` , "REQUEST_CHANGES" , "bad" },
168175 c {`pr review --approve` , "APPROVE" , "" },
169- c {`pr review --approve= "hot damn"` , "APPROVE" , "hot damn" },
170- c {`pr review --comment= "i donno"` , "COMMENT" , "i donno" },
176+ c {`pr review --approve -b "hot damn"` , "APPROVE" , "hot damn" },
177+ c {`pr review --comment --body "i donno"` , "COMMENT" , "i donno" },
171178 }
172179
173180 for _ , kase := range cases {
0 commit comments