Free, Open Source, Self-Hosted WhatsApp API Gateway
TypeScript apibotgatewayself-hostedwhatsappwhatsapp-apiwhatsapp-automationwhatsapp-botwhatsapp-gatewaywhatsapp-gateway-apiwhatsapp-webwhatsapp-web-api
test(message): cover the chat a gated edit is judged by
Yudhi Armyndharisec2809650408
diff --git a/src/modules/message/message.service.spec.ts b/src/modules/message/message.service.spec.tsindex 1ed632b96..b74923246 100644--- a/src/modules/message/message.service.spec.ts+++ b/src/modules/message/message.service.spec.ts@@ -898,6 +898,22 @@ describe('MessageService', () => {);});+ it('judges the stored row by the chat the gate sent the edit to, not the one the caller named', async () => {+ (hookManager.execute as jest.Mock).mockResolvedValueOnce({+ continue: true,+ data: { input: { chatId: '[email protected]', messageId: 'wa-msg-1', body: 'edited' } },+ });++ await service.editMessage('sess-1', { chatId: '[email protected]', messageId: 'wa-msg-1', body: 'edited' });++ expect(mockEngine.editMessage).toHaveBeenCalledWith('[email protected]', 'wa-msg-1', 'edited');+ expect(messageProjector.recordOutboundMessageEdit).toHaveBeenCalledWith('sess-1', 'wa-msg-1', 'edited', {+ kind: 'edit',+ chatId: '[email protected]',+ fromMe: true,+ });+ });+it('honours a plugin that rewrites the tag list, not the list the caller sent', async () => {// message:sending is a moderation chokepoint, so a handler that drops a WID from the list must// win. Reading the caller's own dto here instead of the gated one would send the unredacted