test(whatsapp): fix reaction normalization test with per-peer dmScope

The test was using default dmScope (main), which routes all DMs to the same
session key regardless of peer ID. This masked the bug we were testing for.

Now uses session.dmScope='per-peer' so normalized vs JID peer IDs actually
produce different session keys, properly testing that reactions land in the
E.164-normalized session.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Nick Sullivan 2026-01-29 13:41:23 -06:00
parent e629254b26
commit 0552730351

View File

@ -189,6 +189,7 @@ describe("web auto-reply inbound reaction system events", () => {
setLoadConfigMock(() => ({
channels: { whatsapp: { allowFrom: ["*"] } },
messages: {},
session: { dmScope: "per-peer" },
}));
let capturedOnReaction: ((reaction: WebInboundReaction) => void) | undefined;
@ -202,7 +203,11 @@ describe("web auto-reply inbound reaction system events", () => {
await monitorWebChannel(false, listenerFactory, false);
const cfg = { channels: { whatsapp: { allowFrom: ["*"] } }, messages: {} };
const cfg = {
channels: { whatsapp: { allowFrom: ["*"] } },
messages: {},
session: { dmScope: "per-peer" },
};
// For DM reactions with senderE164, the peer ID should be normalized to E.164
// to match how messages are routed (via resolvePeerId).