From 270a4f5b595dfca36a0792b1d8a3dd4cd2b68e15 Mon Sep 17 00:00:00 2001 From: Vincent Koc Date: Sat, 21 Feb 2026 02:49:36 -0500 Subject: [PATCH] test(gateway): fix HookAction narrowing in prototype protection tests --- src/gateway/hooks-mapping.test.ts | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/src/gateway/hooks-mapping.test.ts b/src/gateway/hooks-mapping.test.ts index d1f16103c4c..05554d7ca79 100644 --- a/src/gateway/hooks-mapping.test.ts +++ b/src/gateway/hooks-mapping.test.ts @@ -390,8 +390,11 @@ describe("hooks mapping", () => { path: "gmail", }); expect(result?.ok).toBe(true); - if (result?.ok && result.action && result.action.kind === "agent") { - expect(result.action.message).toBe("value: "); + if (result?.ok) { + const action = result.action; + if (action?.kind === "agent") { + expect(action.message).toBe("value: "); + } } }); @@ -411,8 +414,11 @@ describe("hooks mapping", () => { path: "gmail", }); expect(result?.ok).toBe(true); - if (result?.ok && result.action && result.action.kind === "agent") { - expect(result.action.message).toBe("type: "); + if (result?.ok) { + const action = result.action; + if (action?.kind === "agent") { + expect(action.message).toBe("type: "); + } } }); @@ -432,8 +438,11 @@ describe("hooks mapping", () => { path: "gmail", }); expect(result?.ok).toBe(true); - if (result?.ok && result.action && result.action.kind === "agent") { - expect(result.action.message).toBe("val: "); + if (result?.ok) { + const action = result.action; + if (action?.kind === "agent") { + expect(action.message).toBe("val: "); + } } }); });