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

Function createMockTranscriptionAdapter

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

Source from the content-addressed store, hash-verified

511
512describe('generateTranscription({ stream: true })', () => {
513 function createMockTranscriptionAdapter(
514 overrides?: Partial<{
515 transcribe: (...args: Array<any>) => Promise<any>
516 }>,
517 ) {
518 return {
519 kind: 'transcription' as const,
520 name: 'test-transcription',
521 model: 'test-model',
522 '~types': {} as any,
523 transcribe:
524 overrides?.transcribe ??
525 vi.fn(async () => ({
526 id: 'txn-1',
527 model: 'test-model',
528 text: 'Hello, this is a transcription.',
529 language: 'en',
530 duration: 5.0,
531 })),
532 }
533 }
534
535 it('should emit RUN_STARTED, CUSTOM result, and RUN_FINISHED', async () => {
536 const adapter = createMockTranscriptionAdapter()

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected