@@ -354,8 +354,26 @@ describe('Google Calendar company crawl', () => {
354354 }
355355 )
356356
357- it ( 'continues another user after an unclassified list access denial and retains its diagnostic' , async ( ) => {
358- fetchMock . mockResolvedValueOnce ( response ( { error : { code : 403 } } , 403 ) )
357+ it . each ( [ { error : { code : 403 } } , { error : { code : 403 , errors : [ ] , details : [ ] } } ] ) (
358+ 'propagates an unclassified list access denial and retains its diagnostic: %j' ,
359+ async ( body ) => {
360+ fetchMock . mockResolvedValueOnce ( response ( body , 403 ) )
361+ const syncContext = context ( )
362+ await expect (
363+ googleCalendarConnector . listDocuments ( 'directory-token' , { } , undefined , syncContext )
364+ ) . rejects . toMatchObject ( {
365+ status : 403 ,
366+ diagnostic : { operation : 'calendar.events.list' , reasons : [ ] } ,
367+ } )
368+ expect ( fetchMock ) . toHaveBeenCalledOnce ( )
369+ expect ( syncContext . getDelegatedAccessToken . mock . calls ) . toEqual ( [ [ ALICE . email ] ] )
370+ }
371+ )
372+
373+ it ( 'continues another user after an explicit forbidden denial and retains its diagnostic' , async ( ) => {
374+ fetchMock . mockResolvedValueOnce (
375+ response ( { error : { code : 403 , errors : [ { reason : 'forbidden' } ] } } , 403 )
376+ )
359377 const first = await googleCalendarConnector . listDocuments (
360378 'directory-token' ,
361379 { } ,
@@ -369,7 +387,12 @@ describe('Google Calendar company crawl', () => {
369387 listingFailures : {
370388 count : 1 ,
371389 samples : [
372- { scope : ALICE . email , operation : 'calendar.events.list' , status : 403 , reasons : [ ] } ,
390+ {
391+ scope : ALICE . email ,
392+ operation : 'calendar.events.list' ,
393+ status : 403 ,
394+ reasons : [ 'forbidden' ] ,
395+ } ,
373396 ] ,
374397 } ,
375398 } )
0 commit comments