From acd8236ef2f05018036eef1c1c19e98cec3f7819 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Tue, 12 May 2026 07:15:51 +0100 Subject: [PATCH] test: guard channel auth mock calls --- src/cli/channel-auth.test.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/cli/channel-auth.test.ts b/src/cli/channel-auth.test.ts index 7d6d0488c64..a05a8a186ff 100644 --- a/src/cli/channel-auth.test.ts +++ b/src/cli/channel-auth.test.ts @@ -89,7 +89,7 @@ function expectFields(value: unknown, expected: Record): void { } function readFirstCallArg(mock: ReturnType): Record { - const [arg] = mock.mock.calls[0] ?? []; + const [arg] = mock.mock.calls.at(0) ?? []; if (!arg || typeof arg !== "object") { throw new Error("expected first call argument object"); } @@ -223,7 +223,7 @@ describe("channel-auth", () => { await runChannelLogin({ channel: "whatsapp", account: "acct-1" }, runtime); expect(mocks.callGateway).not.toHaveBeenCalled(); - expect(String(runtime.log.mock.calls[0]?.[0])).toContain("Gateway is in remote mode"); + expect(String(runtime.log.mock.calls.at(0)?.[0])).toContain("Gateway is in remote mode"); }); it("keeps login successful when local gateway runtime reconcile fails", async () => { @@ -233,7 +233,7 @@ describe("channel-auth", () => { runChannelLogin({ channel: "whatsapp", account: "acct-1" }, runtime), ).resolves.toBeUndefined(); - expect(String(runtime.log.mock.calls[0]?.[0])).toContain( + expect(String(runtime.log.mock.calls.at(0)?.[0])).toContain( "running gateway did not restart it: gateway unreachable", ); }); @@ -565,7 +565,7 @@ describe("channel-auth", () => { account: { id: "resolved-account" }, runtime, }); - expect(String(runtime.log.mock.calls[0]?.[0])).toContain( + expect(String(runtime.log.mock.calls.at(0)?.[0])).toContain( "running gateway did not stop it: gateway unreachable", ); expect(mocks.setVerbose).not.toHaveBeenCalled();