Skip to content

fix(engine): correct mock call index in multi-track audioMixer test#1144

Merged
miguel-heygen merged 1 commit into
mainfrom
fix/audiomixer-test-call-index
Jun 1, 2026
Merged

fix(engine): correct mock call index in multi-track audioMixer test#1144
miguel-heygen merged 1 commit into
mainfrom
fix/audiomixer-test-call-index

Conversation

@miguel-heygen
Copy link
Copy Markdown
Collaborator

Root cause

processCompositionAudio prepares all tracks in parallel via Promise.all, so for N tracks the mix call lands at mock call index N, not index 1. The 3-track test added in hf#1140 was reading calls[1] (the second prepare call) instead of calls[3] (the actual mix call), causing indexOf("-filter_complex") to return -1 and all subsequent assertions to read the wrong args.

Fix

Change mock.calls[1]?.[0]mock.calls[3]?.[0] in the multi-track test and add expect(runFfmpegMock).toHaveBeenCalledTimes(4) to pin the call structure explicitly (3 prepare + 1 mix).

Verification

vitest run packages/engine/src/services/audioMixer.test.ts — 6/6 pass.

processCompositionAudio prepares all tracks in parallel (Promise.all),
so for N tracks the mix call lands at index N, not index 1. The 3-track
test was reading calls[1] (the second prepare call) instead of calls[3]
(the mix call), causing indexOf("-filter_complex") to return -1 and the
subsequent assertions to read the wrong args.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@miguel-heygen miguel-heygen merged commit 5e28738 into main Jun 1, 2026
41 checks passed
@miguel-heygen miguel-heygen deleted the fix/audiomixer-test-call-index branch June 1, 2026 00:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant