@@ -79,15 +79,17 @@ describe('Auto-approval bot', () => {
7979 excludeLabels : [ ] ,
8080 } ) ,
8181 octokit : {
82- checks : {
83- listForRef : vi . fn ( ) . mockResolvedValue ( {
84- data : {
85- check_runs : [ { name : 'test-check' , status : 'completed' , conclusion : 'success' } ] ,
86- } ,
87- } ) ,
88- } ,
89- pulls : {
90- createReview : vi . fn ( ) . mockResolvedValue ( { } ) ,
82+ rest : {
83+ checks : {
84+ listForRef : vi . fn ( ) . mockResolvedValue ( {
85+ data : {
86+ check_runs : [ { name : 'test-check' , status : 'completed' , conclusion : 'success' } ] ,
87+ } ,
88+ } ) ,
89+ } ,
90+ pulls : {
91+ createReview : vi . fn ( ) . mockResolvedValue ( { } ) ,
92+ } ,
9193 } ,
9294 } ,
9395 }
@@ -96,7 +98,7 @@ describe('Auto-approval bot', () => {
9698 await openPrHandler ( context )
9799
98100 // Verify the approval call was made
99- expect ( context . octokit . pulls . createReview ) . toHaveBeenCalledWith ( {
101+ expect ( context . octokit . rest . pulls . createReview ) . toHaveBeenCalledWith ( {
100102 owner : 'test-owner' ,
101103 repo : 'test-repo' ,
102104 pull_number : 1 ,
@@ -139,15 +141,17 @@ describe('Auto-approval bot', () => {
139141 excludeLabels : [ 'do-not-merge' ] ,
140142 } ) ,
141143 octokit : {
142- checks : {
143- listForRef : vi . fn ( ) . mockResolvedValue ( {
144- data : {
145- check_runs : [ { name : 'test-check' , status : 'completed' , conclusion : 'success' } ] ,
146- } ,
147- } ) ,
148- } ,
149- pulls : {
150- createReview : vi . fn ( ) . mockResolvedValue ( { } ) ,
144+ rest : {
145+ checks : {
146+ listForRef : vi . fn ( ) . mockResolvedValue ( {
147+ data : {
148+ check_runs : [ { name : 'test-check' , status : 'completed' , conclusion : 'success' } ] ,
149+ } ,
150+ } ) ,
151+ } ,
152+ pulls : {
153+ createReview : vi . fn ( ) . mockResolvedValue ( { } ) ,
154+ } ,
151155 } ,
152156 } ,
153157 }
@@ -156,7 +160,7 @@ describe('Auto-approval bot', () => {
156160 await openPrHandler ( context )
157161
158162 // Verify the approval call was NOT made
159- expect ( context . octokit . pulls . createReview ) . not . toHaveBeenCalled ( )
163+ expect ( context . octokit . rest . pulls . createReview ) . not . toHaveBeenCalled ( )
160164 } )
161165
162166 it ( 'only checks specific required checks when configured' , async ( ) => {
@@ -193,18 +197,20 @@ describe('Auto-approval bot', () => {
193197 excludeLabels : [ ] ,
194198 } ) ,
195199 octokit : {
196- checks : {
197- listForRef : vi . fn ( ) . mockResolvedValue ( {
198- data : {
199- check_runs : [
200- { name : 'required-check' , status : 'completed' , conclusion : 'success' } ,
201- { name : 'other-check' , status : 'completed' , conclusion : 'failure' } ,
202- ] ,
203- } ,
204- } ) ,
205- } ,
206- pulls : {
207- createReview : vi . fn ( ) . mockResolvedValue ( { } ) ,
200+ rest : {
201+ checks : {
202+ listForRef : vi . fn ( ) . mockResolvedValue ( {
203+ data : {
204+ check_runs : [
205+ { name : 'required-check' , status : 'completed' , conclusion : 'success' } ,
206+ { name : 'other-check' , status : 'completed' , conclusion : 'failure' } ,
207+ ] ,
208+ } ,
209+ } ) ,
210+ } ,
211+ pulls : {
212+ createReview : vi . fn ( ) . mockResolvedValue ( { } ) ,
213+ } ,
208214 } ,
209215 } ,
210216 }
@@ -213,7 +219,7 @@ describe('Auto-approval bot', () => {
213219 await openPrHandler ( context )
214220
215221 // Verify the approval call was made
216- expect ( context . octokit . pulls . createReview ) . toHaveBeenCalledWith ( {
222+ expect ( context . octokit . rest . pulls . createReview ) . toHaveBeenCalledWith ( {
217223 owner : 'test-owner' ,
218224 repo : 'test-repo' ,
219225 pull_number : 1 ,
@@ -258,15 +264,17 @@ describe('Auto-approval bot', () => {
258264 excludeLabels : [ ] ,
259265 } ) ,
260266 octokit : {
261- checks : {
262- listForRef : vi . fn ( ) . mockResolvedValue ( {
263- data : {
264- check_runs : [ { name : 'test-check' , status : 'completed' , conclusion : 'success' } ] ,
265- } ,
266- } ) ,
267- } ,
268- pulls : {
269- createReview : vi . fn ( ) . mockResolvedValue ( { } ) ,
267+ rest : {
268+ checks : {
269+ listForRef : vi . fn ( ) . mockResolvedValue ( {
270+ data : {
271+ check_runs : [ { name : 'test-check' , status : 'completed' , conclusion : 'success' } ] ,
272+ } ,
273+ } ) ,
274+ } ,
275+ pulls : {
276+ createReview : vi . fn ( ) . mockResolvedValue ( { } ) ,
277+ } ,
270278 } ,
271279 } ,
272280 }
@@ -275,7 +283,7 @@ describe('Auto-approval bot', () => {
275283 await reviewDismissedHandler ( context )
276284
277285 // Verify the approval call was made
278- expect ( context . octokit . pulls . createReview ) . toHaveBeenCalledWith ( {
286+ expect ( context . octokit . rest . pulls . createReview ) . toHaveBeenCalledWith ( {
279287 owner : 'test-owner' ,
280288 repo : 'test-repo' ,
281289 pull_number : 1 ,
0 commit comments