From b182845b8035eab57b32c93edca5338acd98620d Mon Sep 17 00:00:00 2001 From: jiarung Date: Sun, 15 Mar 2026 14:06:19 +0000 Subject: [PATCH] fix(test): use out-of-grace-window timestamp in append skip test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 843e3c1ef restored a recency grace window (60 s) for append messages: messages newer than connectedAtMs - 60 s are still forwarded to onMessage so genuinely recent offline arrivals trigger auto-reply. The test 'handles append messages by marking them read but skipping auto-reply' used nowSeconds() as the message timestamp, which falls inside the grace window and therefore reaches onMessage — contradicting the expect(onMessage).not.toHaveBeenCalled() assertion. Fix: use nowSeconds(-120_000) (2 minutes before now) so the message is clearly outside the grace window and the append-recency filter correctly skips it. --- ...-inbox.allows-messages-from-senders-allowfrom-list.test.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/extensions/whatsapp/src/monitor-inbox.allows-messages-from-senders-allowfrom-list.test.ts b/extensions/whatsapp/src/monitor-inbox.allows-messages-from-senders-allowfrom-list.test.ts index 545a010ed50..75bb94c966f 100644 --- a/extensions/whatsapp/src/monitor-inbox.allows-messages-from-senders-allowfrom-list.test.ts +++ b/extensions/whatsapp/src/monitor-inbox.allows-messages-from-senders-allowfrom-list.test.ts @@ -265,7 +265,9 @@ describe("web monitor inbox", () => { remoteJid: "999@s.whatsapp.net", }, message: { conversation: "old message" }, - messageTimestamp: nowSeconds(), + // Use a timestamp well outside the recency grace window (> 60 s before + // connection) so the append-recency filter correctly skips auto-reply. + messageTimestamp: nowSeconds(-120_000), pushName: "History Sender", }, ],