mirror of
https://github.com/wu736139669/hapi.git
synced 2026-08-05 06:24:37 +00:00
fix(hub,web): handle unavailable voice backends
via [HAPI](https://hapi.run) Co-Authored-By: HAPI <noreply@hapi.run>
This commit is contained in:
@@ -127,4 +127,14 @@ describe('ApiClient error mapping', () => {
|
||||
expect(init?.body).toBeInstanceOf(FormData)
|
||||
expect(new Headers(init?.headers).has('content-type')).toBe(false)
|
||||
})
|
||||
|
||||
it('preserves an unavailable voice backend response', async () => {
|
||||
fetchMock.mockResolvedValueOnce(
|
||||
new Response(JSON.stringify({ backend: null, backends: [] }), { status: 200 })
|
||||
)
|
||||
|
||||
const api = new ApiClient('test-token')
|
||||
await expect(api.fetchVoiceBackend()).resolves.toEqual({ backend: null, backends: [] })
|
||||
expect(fetchMock.mock.calls[0]?.[0]).toBe('/api/voice/backend')
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user