Skip to content

Commit a9480f3

Browse files
committed
test(search): check that provider failures keep their HTTP status
1 parent 77593c6 commit a9480f3

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

‎apps/sim/lib/sim-search/live/http.test.ts‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,22 @@ describe('native search network boundary', () => {
7474
)
7575
expect(inputValidationMockFns.mockSecureFetchWithValidation).not.toHaveBeenCalled()
7676
})
77+
it('keeps the HTTP status of a provider failure so callers can tell a missing item apart', async () => {
78+
const client = createNativeClient({
79+
origin: 'https://api.atlassian.com',
80+
accessToken: 'private',
81+
signal: new AbortController().signal,
82+
})
83+
for (const status of [404, 500]) {
84+
inputValidationMockFns.mockSecureFetchWithValidation.mockResolvedValueOnce(
85+
new Response('missing', { status })
86+
)
87+
await expect(client.json('/ex/confluence/cloud/wiki/api/v2/pages/1')).rejects.toMatchObject({
88+
status: 'unavailable',
89+
httpStatus: status,
90+
})
91+
}
92+
})
7793
it('reports Retry-After without exposing the provider response body', async () => {
7894
inputValidationMockFns.mockSecureFetchWithValidation.mockResolvedValue(
7995
new Response('sensitive diagnostic', { status: 429, headers: { 'Retry-After': '45' } })

0 commit comments

Comments
 (0)