|
|
|
|
@ -115,26 +115,28 @@ test('completar tarea: camino feliz, ya completada y no encontrada', async () =>
|
|
|
|
|
created_by: '1111111111',
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
const dc = Number((memDb.prepare(`SELECT display_code FROM tasks WHERE id = ?`).get(taskId) as any)?.display_code || 0);
|
|
|
|
|
|
|
|
|
|
// 1) Camino feliz
|
|
|
|
|
let responses = await CommandService.handle({
|
|
|
|
|
sender: '1234567890',
|
|
|
|
|
groupId: 'test-group@g.us',
|
|
|
|
|
mentions: [],
|
|
|
|
|
message: `/t x ${taskId}`
|
|
|
|
|
message: `/t x ${dc}`
|
|
|
|
|
});
|
|
|
|
|
expect(responses.length).toBe(1);
|
|
|
|
|
expect(responses[0].recipient).toBe('1234567890');
|
|
|
|
|
expect(responses[0].message).toMatch(/^✅ `\d{4}` _completada_/);
|
|
|
|
|
|
|
|
|
|
// 2) Ya completada
|
|
|
|
|
// 2) Ya completada (ahora no debe resolverse por display_code → no encontrada)
|
|
|
|
|
responses = await CommandService.handle({
|
|
|
|
|
sender: '1234567890',
|
|
|
|
|
groupId: 'test-group@g.us',
|
|
|
|
|
mentions: [],
|
|
|
|
|
message: `/t x ${taskId}`
|
|
|
|
|
message: `/t x ${dc}`
|
|
|
|
|
});
|
|
|
|
|
expect(responses.length).toBe(1);
|
|
|
|
|
expect(responses[0].message).toContain('_Ya estaba completada_');
|
|
|
|
|
expect(responses[0].message).toContain('no encontrada');
|
|
|
|
|
|
|
|
|
|
// 3) No encontrada
|
|
|
|
|
responses = await CommandService.handle({
|
|
|
|
|
|