fix(hub,web): handle unavailable voice backends

via [HAPI](https://hapi.run)

Co-Authored-By: HAPI <noreply@hapi.run>
This commit is contained in:
2026-08-03 15:13:36 +08:00
co-authored by HAPI
parent 966c667597
commit ecee2ab4c2
4 changed files with 53 additions and 5 deletions
+10
View File
@@ -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')
})
})