From 43f94e3ab8152f603273250fe300e78dcff4ad6b Mon Sep 17 00:00:00 2001 From: Glucksberg Date: Wed, 4 Feb 2026 03:18:39 +0000 Subject: [PATCH] fix: strengthen test assertions - assert array lengths before indexing --- src/media-understanding/runner.skip-tiny-audio.test.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/media-understanding/runner.skip-tiny-audio.test.ts b/src/media-understanding/runner.skip-tiny-audio.test.ts index 1af70408f12..003b3060cd3 100644 --- a/src/media-understanding/runner.skip-tiny-audio.test.ts +++ b/src/media-understanding/runner.skip-tiny-audio.test.ts @@ -65,8 +65,10 @@ describe("runCapability skips tiny audio files", () => { // The result should indicate the attachment was skipped expect(result.outputs).toHaveLength(0); expect(result.decision.outcome).toBe("skipped"); - expect(result.decision.attachments[0]?.attempts[0]?.outcome).toBe("skipped"); - expect(result.decision.attachments[0]?.attempts[0]?.reason).toContain("tooSmall"); + expect(result.decision.attachments).toHaveLength(1); + expect(result.decision.attachments[0].attempts).toHaveLength(1); + expect(result.decision.attachments[0].attempts[0].outcome).toBe("skipped"); + expect(result.decision.attachments[0].attempts[0].reason).toContain("tooSmall"); } finally { process.env.PATH = originalPath; await cache.cleanup();