The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
test(voice): add coverage for pcm capture, playback, and live session
Steven Enamakel5856bea6e63c
diff --git a/app/src/features/human/voice/live/pcmCaptureWorklet.test.ts b/app/src/features/human/voice/live/pcmCaptureWorklet.test.tsindex 0dd7b78f41..0b6db02831 100644--- a/app/src/features/human/voice/live/pcmCaptureWorklet.test.ts+++ b/app/src/features/human/voice/live/pcmCaptureWorklet.test.ts@@ -38,7 +38,7 @@ function loadProcessor(contextRate: number) {class AudioWorkletProcessor {port = { postMessage: vi.fn() };}- // eslint-disable-next-line @typescript-eslint/no-implied-eval -- evaluates the shipped asset in a fake worklet scope+ // Evaluates the shipped asset in a fake AudioWorkletGlobalScope.new Function('AudioWorkletProcessor', 'registerProcessor', 'sampleRate', source)(AudioWorkletProcessor,(name: string, ctor: new (opts: unknown) => ProcessorInstance) => {diff --git a/app/src/features/human/voice/live/pcmPlayer.test.ts b/app/src/features/human/voice/live/pcmPlayer.test.tsindex 052f2727a0..611343da94 100644--- a/app/src/features/human/voice/live/pcmPlayer.test.ts+++ b/app/src/features/human/voice/live/pcmPlayer.test.ts@@ -141,14 +141,20 @@ describe('PcmPlayer', () => {it('uses window.AudioContext by default', () => {const ctx = new FakeAudioContext();- const Ctor = vi.fn(function () {- return ctx;- });- vi.stubGlobal('AudioContext', Ctor);+ const constructed = vi.fn();+ vi.stubGlobal(+ 'AudioContext',+ class {+ constructor() {+ constructed();+ return ctx;+ }+ }+ );try {const player = new PcmPlayer({ sampleRate: 16_000 });player.enqueue(pcmBytes(16));- expect(Ctor).toHaveBeenCalled();+ expect(constructed).toHaveBeenCalled();expect(ctx.sources).toHaveLength(1);} finally {vi.unstubAllGlobals();diff --git a/app/src/features/human/voice/live/useLiveVoiceSession.test.tsx b/app/src/features/human/voice/live/useLiveVoiceSession.test.tsxindex aded632d71..52063d9b96 100644--- a/app/src/features/human/voice/live/useLiveVoiceSession.test.tsx+++ b/app/src/features/human/voice/live/useLiveVoiceSession.test.tsx@@ -86,11 +86,13 @@ describe('useLiveVoiceSession', () => {vi.stubGlobal('WebSocket', FakeWebSocket);vi.stubGlobal('AudioContext',- vi.fn(function () {- const ctx = new FakeAudioContext();- audioContexts.push(ctx);- return ctx;- })+ class {+ constructor() {+ const ctx = new FakeAudioContext();+ audioContexts.push(ctx);+ return ctx;+ }+ });mocks.socketHandlers.clear();mocks.socketId = 'sock-1';