Free, Open Source, Self-Hosted WhatsApp API Gateway
TypeScript apibotgatewayself-hostedwhatsappwhatsapp-apiwhatsapp-automationwhatsapp-botwhatsapp-gatewaywhatsapp-gateway-apiwhatsapp-webwhatsapp-web-api
test(status): check each malformed recipient JID on its own
Yudhi Armyndharisaf99912b8809
diff --git a/src/modules/status/dto/send-media-status.dto.spec.ts b/src/modules/status/dto/send-media-status.dto.spec.tsindex 79538a0df..7746648b2 100644--- a/src/modules/status/dto/send-media-status.dto.spec.ts+++ b/src/modules/status/dto/send-media-status.dto.spec.ts@@ -32,13 +32,8 @@ describe('SendImageStatusDto recipients validation', () => {expect(errors.some(e => e.property === 'recipients')).toBe(true);});- it('rejects malformed JIDs', async () => {- const errors = await validate(- plainToInstance(SendImageStatusDto, {- image: valid.image,- recipients: ['not-a-jid', '[email protected]', '@c.us', 'abc@lid'],- }),- );+ it.each(['not-a-jid', '[email protected]', '@c.us', 'abc@lid'])('rejects the malformed JID %s', async jid => {+ const errors = await validate(plainToInstance(SendImageStatusDto, { image: valid.image, recipients: [jid] }));expect(errors.some(e => e.property === 'recipients')).toBe(true);});@@ -79,13 +74,8 @@ describe('SendVideoStatusDto recipients validation', () => {expect(errors.some(e => e.property === 'recipients')).toBe(true);});- it('rejects malformed JIDs', async () => {- const errors = await validate(- plainToInstance(SendVideoStatusDto, {- video: valid.video,- recipients: ['not-a-jid', '[email protected]', '@c.us', 'abc@lid'],- }),- );+ it.each(['not-a-jid', '[email protected]', '@c.us', 'abc@lid'])('rejects the malformed JID %s', async jid => {+ const errors = await validate(plainToInstance(SendVideoStatusDto, { video: valid.video, recipients: [jid] }));expect(errors.some(e => e.property === 'recipients')).toBe(true);});