From f4c3e483fece2fcbf2308ff75308c3e8a544c802 Mon Sep 17 00:00:00 2001 From: bmendonca3 Date: Sun, 1 Mar 2026 01:10:44 -0700 Subject: [PATCH] zalouser: update account-scope test for scoped store API --- .../src/monitor.account-scope.test.ts | 25 ++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/extensions/zalouser/src/monitor.account-scope.test.ts b/extensions/zalouser/src/monitor.account-scope.test.ts index 14c1520d003..1cdab86eeda 100644 --- a/extensions/zalouser/src/monitor.account-scope.test.ts +++ b/extensions/zalouser/src/monitor.account-scope.test.ts @@ -13,8 +13,22 @@ vi.mock("./send.js", () => ({ describe("zalouser monitor pairing account scoping", () => { it("scopes DM pairing-store reads and pairing requests to accountId", async () => { const readAllowFromStore = vi.fn( - async (_channel: string, _env?: NodeJS.ProcessEnv, accountId?: string) => - accountId === "beta" ? [] : ["attacker"], + async ( + channelOrParams: + | string + | { + channel?: string; + accountId?: string; + }, + _env?: NodeJS.ProcessEnv, + accountId?: string, + ) => { + const scopedAccountId = + typeof channelOrParams === "object" && channelOrParams !== null + ? channelOrParams.accountId + : accountId; + return scopedAccountId === "beta" ? [] : ["attacker"]; + }, ); const upsertPairingRequest = vi.fn(async () => ({ code: "PAIRME88", created: true })); @@ -86,7 +100,12 @@ describe("zalouser monitor pairing account scoping", () => { runtime, }); - expect(readAllowFromStore).toHaveBeenCalledWith("zalouser", undefined, "beta"); + expect(readAllowFromStore).toHaveBeenCalledWith( + expect.objectContaining({ + channel: "zalouser", + accountId: "beta", + }), + ); expect(upsertPairingRequest).toHaveBeenCalledWith( expect.objectContaining({ channel: "zalouser",