File tree Expand file tree Collapse file tree 1 file changed +26
-9
lines changed
Expand file tree Collapse file tree 1 file changed +26
-9
lines changed Original file line number Diff line number Diff line change @@ -360,19 +360,36 @@ describe('main() auto-pass integration', () => {
360360 } )
361361
362362 // Mock github.getOctokit to return empty results (all checks passing)
363+ const mockRepos = {
364+ getCombinedStatusForRef : jest . fn ( )
365+ }
366+ const mockChecks = {
367+ listForRef : jest . fn ( )
368+ }
363369 const mockOctokit = {
364370 paginate : {
365- iterator : jest . fn ( ) . mockReturnValue ( ( async function * ( ) {
366- yield { data : { statuses : [ ] } }
367- } ) ( ) )
371+ iterator : jest . fn ( ) . mockImplementation ( ( endpoint : any , _params : any ) => {
372+ // Paginated combined status responses
373+ if ( endpoint === mockRepos . getCombinedStatusForRef ) {
374+ return ( async function * ( ) {
375+ yield { data : { statuses : [ ] } }
376+ } ) ( )
377+ }
378+ // Paginated check run responses
379+ if ( endpoint === mockChecks . listForRef ) {
380+ return ( async function * ( ) {
381+ yield { data : [ ] }
382+ } ) ( )
383+ }
384+ // Default: empty array-shaped data
385+ return ( async function * ( ) {
386+ yield { data : [ ] }
387+ } ) ( )
388+ } )
368389 } ,
369390 rest : {
370- repos : {
371- getCombinedStatusForRef : jest . fn ( )
372- } ,
373- checks : {
374- listForRef : jest . fn ( )
375- }
391+ repos : mockRepos ,
392+ checks : mockChecks
376393 }
377394 }
378395 jest . spyOn ( github , 'getOctokit' ) . mockReturnValue ( mockOctokit as any )
You can’t perform that action at this time.
0 commit comments