Files
airi/packages/testing-audio/src/expect-extend.test.ts
T

29 lines
869 B
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import type { AudioInputObservations } from './types'
import { describe, it } from 'vitest'
import { expect, installAudioInputMatchers } from './expect-extend'
installAudioInputMatchers()
describe('audio input matchers', () => {
it('normalizes transcription case, width, punctuation, and whitespace', async () => {
const session = createAudioInputSession(['lease, SAY hello!'])
await expect(session).toHaveTranscriptions([
['please say hello'],
])
})
})
function createAudioInputSession(transcriptions: string[]): AudioInputObservations {
return {
capturedTranscriptionAudio: async () => [],
streamingTranscriptionUpdates: async () => [],
transcriptionResults: async () => transcriptions,
completedSpans: async () => [],
waitForStreamingTranscriptionReady: async () => {},
waitForVadReady: async () => {},
}
}