@@ -502,21 +502,24 @@ describe('Google Workspace per-user central crawl', () => {
502502 expect ( ( await list ( context ( ) , undefined , CONFIG , 'google_calendar' ) ) . documents ) . toHaveLength ( 1 )
503503 } )
504504
505- it ( 'isolates explicit Calendar list access failures without claiming a disabled service' , async ( ) => {
506- listUserDocuments . mockRejectedValueOnce (
507- new GoogleApiError ( 'calendar.events.list' , 403 , [ 'forbidden' ] )
508- )
509- const first = await list ( context ( ) , undefined , CONFIG , 'google_calendar' )
510- expect ( first . listingFailures ?. samples [ 0 ] ) . toEqual ( {
511- scope : 'alice@corp.com' ,
512- operation : 'calendar.events.list' ,
513- status : 403 ,
514- reasons : [ 'forbidden' ] ,
515- } )
516- const second = await list ( context ( ) , first . nextCursor , CONFIG , 'google_calendar' )
517- expect ( second . documents [ 0 ] . acl ) . toEqual ( [ 'u:bob@corp.com' ] )
518- expect ( second . reconciliationSafe ) . toBe ( false )
519- } )
505+ it . each ( [ 'forbidden' , 'notACalendarUser' ] ) (
506+ 'isolates explicit Calendar list access failures (%s) without claiming a disabled service' ,
507+ async ( reason ) => {
508+ listUserDocuments . mockRejectedValueOnce (
509+ new GoogleApiError ( 'calendar.events.list' , 403 , [ reason ] )
510+ )
511+ const first = await list ( context ( ) , undefined , CONFIG , 'google_calendar' )
512+ expect ( first . listingFailures ?. samples [ 0 ] ) . toEqual ( {
513+ scope : 'alice@corp.com' ,
514+ operation : 'calendar.events.list' ,
515+ status : 403 ,
516+ reasons : [ reason ] ,
517+ } )
518+ const second = await list ( context ( ) , first . nextCursor , CONFIG , 'google_calendar' )
519+ expect ( second . documents [ 0 ] . acl ) . toEqual ( [ 'u:bob@corp.com' ] )
520+ expect ( second . reconciliationSafe ) . toBe ( false )
521+ }
522+ )
520523
521524 it . each ( [ { error : { code : 403 } } , { error : { code : 403 , errors : [ ] , details : [ ] } } ] ) (
522525 'propagates a Calendar 403 without reason codes: %j' ,
@@ -542,6 +545,9 @@ describe('Google Workspace per-user central crawl', () => {
542545 [ 403 , [ 'domainPolicy' ] ] ,
543546 [ 403 , [ 'unrecognized-provider-code' ] ] ,
544547 [ 403 , [ 'forbidden' , 'unrecognized-provider-code' ] ] ,
548+ [ 403 , [ 'notACalendarUser' , 'unrecognized-provider-code' ] ] ,
549+ [ 403 , [ 'notACalendarUser' , 'insufficientPermissions' ] ] ,
550+ [ 403 , [ 'notACalendarUser' , 'rateLimitExceeded' ] ] ,
545551 [ 401 , [ 'authError' ] ] ,
546552 [ 429 , [ ] ] ,
547553 [ 500 , [ 'backendError' ] ] ,
@@ -571,6 +577,15 @@ describe('Google Workspace per-user central crawl', () => {
571577 await expect ( list ( context ( ) , undefined , CONFIG , 'google_calendar' ) ) . rejects . toBe ( error )
572578 } )
573579
580+ it . each ( [
581+ new GoogleApiError ( 'calendar.events.list' , 403 , [ 'notACalendarUser' ] , false ) ,
582+ new GoogleApiError ( 'calendar.calendarList.list' , 403 , [ 'notACalendarUser' ] ) ,
583+ new GoogleApiError ( 'calendar.events.list' , 401 , [ 'notACalendarUser' ] ) ,
584+ ] ) ( 'does not isolate Calendar unavailability outside a complete list 403: %s' , async ( error ) => {
585+ listUserDocuments . mockRejectedValueOnce ( error )
586+ await expect ( list ( context ( ) , undefined , CONFIG , 'google_calendar' ) ) . rejects . toBe ( error )
587+ } )
588+
574589 it ( 'does not suppress delegation failures that resemble provider list failures' , async ( ) => {
575590 const ctx = context ( )
576591 const error = new GoogleApiError ( 'gmail.threads.list' , 400 , [ 'failedPrecondition' ] )
0 commit comments