MCPcopy Create free account
hub / github.com/TanStack/ai / createMockTTSAdapter

Function createMockTTSAdapter

packages/ai/tests/stream-generation.test.ts:424–445  ·  view source on GitHub ↗
(
    overrides?: Partial<{
      generateSpeech: (...args: Array<any>) => Promise<any>
    }>,
  )

Source from the content-addressed store, hash-verified

422
423describe('generateSpeech({ stream: true })', () => {
424 function createMockTTSAdapter(
425 overrides?: Partial<{
426 generateSpeech: (...args: Array<any>) => Promise<any>
427 }>,
428 ) {
429 return {
430 kind: 'tts' as const,
431 name: 'test-tts',
432 model: 'test-model',
433 '~types': {} as any,
434 generateSpeech:
435 overrides?.generateSpeech ??
436 vi.fn(async () => ({
437 id: 'speech-1',
438 model: 'test-model',
439 audio: 'base64-audio-data',
440 format: 'mp3',
441 duration: 2.5,
442 contentType: 'audio/mp3',
443 })),
444 }
445 }
446
447 it('should emit RUN_STARTED, CUSTOM result, and RUN_FINISHED', async () => {
448 const adapter = createMockTTSAdapter()

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected