Free, Open Source, Self-Hosted WhatsApp API Gateway
TypeScript apibotgatewayself-hostedwhatsappwhatsapp-apiwhatsapp-automationwhatsapp-botwhatsapp-gatewaywhatsapp-gateway-apiwhatsapp-webwhatsapp-web-api
test(contact): lock the neutral-dialect handoff to the engine
Yudhi Armyndharis4f4d750c686f
diff --git a/src/modules/contact/contact.service.spec.ts b/src/modules/contact/contact.service.spec.tsindex aa15e0af1..2954c71dc 100644--- a/src/modules/contact/contact.service.spec.ts+++ b/src/modules/contact/contact.service.spec.ts@@ -144,6 +144,21 @@ describe('ContactService', () => {expect(unblockContact).toHaveBeenCalledWith('12345678901234567890@lid');});+ /**+ * Neutralizing covers the raw-protocol dialect too, which used to reach the engine verbatim.+ * That is a round trip, not a loss: the Baileys adapter hands the jid to `updateBlockStatus`,+ * which starts with `jidNormalizedUser` and turns `@c.us` straight back into `@s.whatsapp.net`.+ * whatsapp-web.js, which has no such dialect, gets the form it actually understands.+ */+ it('hands the engine the neutral dialect for a raw-protocol id', () => {+ const blockContact = jest.fn();+ const svc = makeService({ blockContact });++ svc.blockContact('s1', '[email protected]');++ expect(blockContact).toHaveBeenCalledWith('[email protected]');+ });+/*** A privacy-id contact has no phone number at all, and the blocklist READ answers those ids* verbatim (Baileys maps each blocked jid through toNeutralJid, which leaves an unresolved lid