|
|
|
@ -79,4 +79,34 @@ describe('ResponseQueue - jobs de reacción (enqueue + sendOne)', () => {
|
|
|
|
expect(captured.payload.reaction).toBe('🤖');
|
|
|
|
expect(captured.payload.reaction).toBe('🤖');
|
|
|
|
expect(captured.payload.key).toEqual({ remoteJid: '123@g.us', fromMe: false, id: 'MSG-99' });
|
|
|
|
expect(captured.payload.key).toEqual({ remoteJid: '123@g.us', fromMe: false, id: 'MSG-99' });
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it('sendOne incluye key.participant cuando viene en metadata (grupo, fromMe:false)', async () => {
|
|
|
|
|
|
|
|
const item = {
|
|
|
|
|
|
|
|
id: 43,
|
|
|
|
|
|
|
|
recipient: '120363401791776728@g.us',
|
|
|
|
|
|
|
|
message: '',
|
|
|
|
|
|
|
|
attempts: 0,
|
|
|
|
|
|
|
|
metadata: JSON.stringify({
|
|
|
|
|
|
|
|
kind: 'reaction',
|
|
|
|
|
|
|
|
emoji: '✅',
|
|
|
|
|
|
|
|
chatId: '120363401791776728@g.us',
|
|
|
|
|
|
|
|
messageId: 'MSG-100',
|
|
|
|
|
|
|
|
participant: '34650861805:32@s.whatsapp.net',
|
|
|
|
|
|
|
|
fromMe: false
|
|
|
|
|
|
|
|
}),
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const res = await ResponseQueue.sendOne(item as any);
|
|
|
|
|
|
|
|
expect(res.ok).toBe(true);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
expect(captured.url?.includes('/message/sendReaction/instance-1')).toBe(true);
|
|
|
|
|
|
|
|
expect(captured.payload).toBeDefined();
|
|
|
|
|
|
|
|
expect(captured.payload.reaction).toBe('✅');
|
|
|
|
|
|
|
|
expect(captured.payload.key).toEqual({
|
|
|
|
|
|
|
|
remoteJid: '120363401791776728@g.us',
|
|
|
|
|
|
|
|
fromMe: false,
|
|
|
|
|
|
|
|
id: 'MSG-100',
|
|
|
|
|
|
|
|
participant: '34650861805:32@s.whatsapp.net'
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|