fix(test): use out-of-grace-window timestamp in append skip test

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.
This commit is contained in:
jiarung 2026-03-15 14:06:19 +00:00
parent a47f7e465c
commit b182845b80

View File

@ -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",
},
],