From 4c14d6c8db56a09ccb1c73bc1070b80c06c14a4c Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Fri, 16 Jan 2026 09:26:14 +0000 Subject: [PATCH] chore: format web monitor inbox tests --- ...ssages-from-senders-allowfrom-list.test.ts | 42 ++++++++++++-- ...unauthorized-senders-not-allowfrom.test.ts | 56 ++++++++++++++++--- 2 files changed, 84 insertions(+), 14 deletions(-) diff --git a/src/web/monitor-inbox.allows-messages-from-senders-allowfrom-list.test.ts b/src/web/monitor-inbox.allows-messages-from-senders-allowfrom-list.test.ts index 4dc7c7ed3..dd835b1a2 100644 --- a/src/web/monitor-inbox.allows-messages-from-senders-allowfrom-list.test.ts +++ b/src/web/monitor-inbox.allows-messages-from-senders-allowfrom-list.test.ts @@ -113,7 +113,12 @@ describe("web monitor inbox", () => { }); const onMessage = vi.fn(); - const listener = await monitorWebInbox({ verbose: false, accountId: ACCOUNT_ID, authDir, onMessage }); + const listener = await monitorWebInbox({ + verbose: false, + accountId: ACCOUNT_ID, + authDir, + onMessage, + }); const sock = await createWaSocket(); const upsert = { @@ -168,7 +173,12 @@ describe("web monitor inbox", () => { }); const onMessage = vi.fn(); - const listener = await monitorWebInbox({ verbose: false, accountId: ACCOUNT_ID, authDir, onMessage }); + const listener = await monitorWebInbox({ + verbose: false, + accountId: ACCOUNT_ID, + authDir, + onMessage, + }); const sock = await createWaSocket(); // Message from self (sock.user.id is "123@s.whatsapp.net" in mock) @@ -211,7 +221,12 @@ describe("web monitor inbox", () => { .mockResolvedValueOnce({ code: "PAIRCODE", created: false }); const onMessage = vi.fn(); - const listener = await monitorWebInbox({ verbose: false, accountId: ACCOUNT_ID, authDir, onMessage }); + const listener = await monitorWebInbox({ + verbose: false, + accountId: ACCOUNT_ID, + authDir, + onMessage, + }); const sock = await createWaSocket(); // Message from someone else should be blocked @@ -316,7 +331,12 @@ describe("web monitor inbox", () => { }); const onMessage = vi.fn(); - const listener = await monitorWebInbox({ verbose: false, accountId: ACCOUNT_ID, authDir, onMessage }); + const listener = await monitorWebInbox({ + verbose: false, + accountId: ACCOUNT_ID, + authDir, + onMessage, + }); const sock = await createWaSocket(); const upsert = { @@ -367,7 +387,12 @@ describe("web monitor inbox", () => { }); const onMessage = vi.fn(); - const listener = await monitorWebInbox({ verbose: false, accountId: ACCOUNT_ID, authDir, onMessage }); + const listener = await monitorWebInbox({ + verbose: false, + accountId: ACCOUNT_ID, + authDir, + onMessage, + }); const sock = await createWaSocket(); const upsert = { @@ -405,7 +430,12 @@ describe("web monitor inbox", () => { it("handles append messages by marking them read but skipping auto-reply", async () => { const onMessage = vi.fn(); - const listener = await monitorWebInbox({ verbose: false, accountId: ACCOUNT_ID, authDir, onMessage }); + const listener = await monitorWebInbox({ + verbose: false, + accountId: ACCOUNT_ID, + authDir, + onMessage, + }); const sock = await createWaSocket(); const upsert = { diff --git a/src/web/monitor-inbox.blocks-messages-from-unauthorized-senders-not-allowfrom.test.ts b/src/web/monitor-inbox.blocks-messages-from-unauthorized-senders-not-allowfrom.test.ts index a7a41b578..f40344ced 100644 --- a/src/web/monitor-inbox.blocks-messages-from-unauthorized-senders-not-allowfrom.test.ts +++ b/src/web/monitor-inbox.blocks-messages-from-unauthorized-senders-not-allowfrom.test.ts @@ -115,7 +115,12 @@ describe("web monitor inbox", () => { }); const onMessage = vi.fn(); - const listener = await monitorWebInbox({ verbose: false, accountId: _ACCOUNT_ID, authDir, onMessage }); + const listener = await monitorWebInbox({ + verbose: false, + accountId: _ACCOUNT_ID, + authDir, + onMessage, + }); const sock = await createWaSocket(); // Message from unauthorized sender +999 (not in allowFrom) @@ -176,7 +181,12 @@ describe("web monitor inbox", () => { }); const onMessage = vi.fn(); - const listener = await monitorWebInbox({ verbose: false, accountId: _ACCOUNT_ID, authDir, onMessage }); + const listener = await monitorWebInbox({ + verbose: false, + accountId: _ACCOUNT_ID, + authDir, + onMessage, + }); const sock = await createWaSocket(); const upsert = { @@ -252,7 +262,12 @@ describe("web monitor inbox", () => { }); const onMessage = vi.fn(); - const listener = await monitorWebInbox({ verbose: false, accountId: _ACCOUNT_ID, authDir, onMessage }); + const listener = await monitorWebInbox({ + verbose: false, + accountId: _ACCOUNT_ID, + authDir, + onMessage, + }); const sock = await createWaSocket(); const upsert = { @@ -293,7 +308,12 @@ describe("web monitor inbox", () => { }); const onMessage = vi.fn(); - const listener = await monitorWebInbox({ verbose: false, accountId: _ACCOUNT_ID, authDir, onMessage }); + const listener = await monitorWebInbox({ + verbose: false, + accountId: _ACCOUNT_ID, + authDir, + onMessage, + }); const sock = await createWaSocket(); const upsert = { @@ -337,7 +357,12 @@ describe("web monitor inbox", () => { }); const onMessage = vi.fn(); - const listener = await monitorWebInbox({ verbose: false, accountId: _ACCOUNT_ID, authDir, onMessage }); + const listener = await monitorWebInbox({ + verbose: false, + accountId: _ACCOUNT_ID, + authDir, + onMessage, + }); const sock = await createWaSocket(); const upsert = { @@ -381,7 +406,12 @@ describe("web monitor inbox", () => { }); const onMessage = vi.fn(); - const listener = await monitorWebInbox({ verbose: false, accountId: _ACCOUNT_ID, authDir, onMessage }); + const listener = await monitorWebInbox({ + verbose: false, + accountId: _ACCOUNT_ID, + authDir, + onMessage, + }); const sock = await createWaSocket(); const upsert = { @@ -428,7 +458,12 @@ describe("web monitor inbox", () => { }); const onMessage = vi.fn(); - const listener = await monitorWebInbox({ verbose: false, accountId: _ACCOUNT_ID, authDir, onMessage }); + const listener = await monitorWebInbox({ + verbose: false, + accountId: _ACCOUNT_ID, + authDir, + onMessage, + }); const sock = await createWaSocket(); const upsert = { @@ -473,7 +508,12 @@ describe("web monitor inbox", () => { }); const onMessage = vi.fn(); - const listener = await monitorWebInbox({ verbose: false, accountId: _ACCOUNT_ID, authDir, onMessage }); + const listener = await monitorWebInbox({ + verbose: false, + accountId: _ACCOUNT_ID, + authDir, + onMessage, + }); const sock = await createWaSocket(); const upsert = {