From 4ce9ff7845a177086095aeb97863e6ba613aa0b6 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Wed, 13 May 2026 03:26:58 +0100 Subject: [PATCH] test: dedupe exec policy mock reads --- src/cli/exec-policy-cli.test.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/cli/exec-policy-cli.test.ts b/src/cli/exec-policy-cli.test.ts index ae7d0983f46..e2b3a074ef0 100644 --- a/src/cli/exec-policy-cli.test.ts +++ b/src/cli/exec-policy-cli.test.ts @@ -40,7 +40,8 @@ function expectFields(value: unknown, expected: Record): void { } function readLastJsonWrite(): Record { - const [payload, space] = mocks.defaultRuntime.writeJson.mock.calls.at(-1) ?? []; + const calls = mocks.defaultRuntime.writeJson.mock.calls; + const [payload, space] = calls[calls.length - 1] ?? []; expect(space).toBe(0); if (!payload || typeof payload !== "object") { throw new Error("expected JSON write payload object"); @@ -59,11 +60,11 @@ function readFirstPolicyScope(payload: Record): Record { - const call = mocks.replaceConfigFile.mock.calls.at(0); + const call = mocks.replaceConfigFile.mock.calls[0]; if (!call) { throw new Error("expected replaceConfigFile call"); } - const arg = call.at(0); + const arg = call[0]; if (!arg || typeof arg !== "object") { throw new Error("expected replaceConfigFile argument"); }