From e5a674a78306740ae09834fb03499d26de710a06 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Tue, 12 May 2026 01:16:53 +0100 Subject: [PATCH] test: guard acpx runtime mock calls --- extensions/acpx/src/runtime.test.ts | 6 +++++- extensions/acpx/src/service.test.ts | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/extensions/acpx/src/runtime.test.ts b/extensions/acpx/src/runtime.test.ts index 35444ba1ac9..5d410573ded 100644 --- a/extensions/acpx/src/runtime.test.ts +++ b/extensions/acpx/src/runtime.test.ts @@ -111,7 +111,11 @@ function makeLeaseStore() { function readFirstEnsureSessionInput(ensure: { mock: { calls: Array> }; }): Parameters[0] { - const input = ensure.mock.calls[0]?.[0]; + const [call] = ensure.mock.calls; + if (!call) { + throw new Error("Expected ensureSession to be called"); + } + const [input] = call; if (typeof input !== "object" || input === null) { throw new Error("Expected ensureSession to be called with an input object"); } diff --git a/extensions/acpx/src/service.test.ts b/extensions/acpx/src/service.test.ts index 022c7d7deab..37b5e61dd22 100644 --- a/extensions/acpx/src/service.test.ts +++ b/extensions/acpx/src/service.test.ts @@ -157,7 +157,11 @@ function createMockRuntime(overrides: Record = {}) { } function readFirstRuntimeFactoryInput(runtimeFactory: { mock: { calls: Array> } }) { - const input = runtimeFactory.mock.calls[0]?.[0]; + const [call] = runtimeFactory.mock.calls; + if (!call) { + throw new Error("Expected runtimeFactory to be called"); + } + const [input] = call; if (typeof input !== "object" || input === null) { throw new Error("Expected runtimeFactory to be called with an options object"); }