Skip to content

Commit 4b10b39

Browse files
committed
fix(search): align Calendar connector regression coverage
1 parent 2279bf5 commit 4b10b39

1 file changed

Lines changed: 26 additions & 3 deletions

File tree

‎apps/sim/connectors/google-calendar/company-crawl.test.ts‎

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)