Free, Open Source, Self-Hosted WhatsApp API Gateway
TypeScript apibotgatewayself-hostedwhatsappwhatsapp-apiwhatsapp-automationwhatsapp-botwhatsapp-gatewaywhatsapp-gateway-apiwhatsapp-webwhatsapp-web-api
test(session): pin the inbound dispatch event name and args in MessageProjector spec
Yudhi Armyndharis6b11e19a495b
diff --git a/src/modules/session/message-projector.service.spec.ts b/src/modules/session/message-projector.service.spec.tsindex 0a87794e0..93ba2c1b5 100644--- a/src/modules/session/message-projector.service.spec.ts+++ b/src/modules/session/message-projector.service.spec.ts@@ -325,8 +325,12 @@ describe('MessageProjector', () => {await new Promise(resolve => setImmediate(resolve));expect(messageRepository.insert).toHaveBeenCalledTimes(1);- expect(eventsGateway.emitMessage).toHaveBeenCalledTimes(1);- expect(webhookService.dispatch).toHaveBeenCalledTimes(1);+ // Pinned to the exact event name and args dispatchInboundMessage passes+ // (message-projector.service.ts:321,323), matching the assertion style+ // session.service.spec.ts uses for the same call sites — a bare call-count assertion would+ // stay green even if the event name flipped to 'message.sent' or the wrong payload was sent.+ expect(eventsGateway.emitMessage).toHaveBeenCalledWith(SESSION_ID, expect.anything());+ expect(webhookService.dispatch).toHaveBeenCalledWith(SESSION_ID, 'message.received', expect.anything());expect(sessionRepository.update).toHaveBeenCalledTimes(1);});