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

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>
This commit is contained in:
Miguel Ángel
2026-05-31 20:24:30 -04:00
committed by GitHub
co-authored by Claude Sonnet 4.6
parent 7ed809e437
commit 5e28738566
@@ -116,7 +116,10 @@ describe("processCompositionAudio", () => {
);
expect(result.success).toBe(true);
const mixArgs = runFfmpegMock.mock.calls[1]?.[0];
// 3 prepare calls (one per track via Promise.all) precede the mix call,
// so the mix is at index 3, not index 1.
expect(runFfmpegMock).toHaveBeenCalledTimes(4);
const mixArgs = runFfmpegMock.mock.calls[3]?.[0];
const filter = mixArgs[mixArgs.indexOf("-filter_complex") + 1];
expect(filter).toContain("amix=inputs=3");