mirror of
https://github.com/nexu-io/open-design.git
synced 2026-06-01 03:14:35 +07:00
* docs: add ElevenLabs audio support design * docs: add ElevenLabs audio implementation plan * feat(daemon): add ElevenLabs speech renderer * feat(daemon): add ElevenLabs sound effects renderer * fix(daemon): preserve ElevenLabs sfx durations * feat(web): expose ElevenLabs media providers * feat(daemon): document ElevenLabs audio contract * feat(audio): add ElevenLabs voice selection * chore: ignore superpowers scratch docs * fix(daemon): cache ElevenLabs voice options * fix(audio): expand ElevenLabs voice and SFX selection * fix(audio): align ElevenLabs SFX controls * fix(audio): tighten ElevenLabs SFX prompt budget * fix(audio): preflight ElevenLabs SFX prompt length * fix(audio): surface ElevenLabs lookup failures * fix(audio): sanitize ElevenLabs prompt errors
33 lines
1 KiB
TypeScript
33 lines
1 KiB
TypeScript
import { afterEach, describe, expect, it, vi } from 'vitest';
|
|
|
|
import { fetchElevenLabsVoiceOptions } from '../../src/providers/elevenlabs-voices';
|
|
|
|
describe('fetchElevenLabsVoiceOptions', () => {
|
|
const realFetch = globalThis.fetch;
|
|
|
|
afterEach(() => {
|
|
globalThis.fetch = realFetch;
|
|
vi.unstubAllGlobals();
|
|
});
|
|
|
|
it('throws a descriptive error when the lookup response is not ok', async () => {
|
|
const fetchMock = vi.fn(async () => new Response(JSON.stringify({
|
|
error: 'upstream temporarily unavailable',
|
|
}), {
|
|
status: 502,
|
|
statusText: 'Bad Gateway',
|
|
headers: {
|
|
'content-type': 'application/json',
|
|
},
|
|
}));
|
|
vi.stubGlobal('fetch', fetchMock);
|
|
|
|
await expect(fetchElevenLabsVoiceOptions()).rejects.toThrow(
|
|
/ElevenLabs voice list could not be loaded \(502 Bad Gateway\): upstream temporarily unavailable/i,
|
|
);
|
|
expect(fetchMock).toHaveBeenCalledWith(
|
|
'/api/media/providers/elevenlabs/voices?limit=100',
|
|
expect.any(Object),
|
|
);
|
|
});
|
|
});
|