fix: update test expectations for command logging

main
borja (aider) 2 months ago
parent d232e8db5f
commit 60ed1d1f82

@ -287,31 +287,26 @@ describe('WebhookServer', () => {
await WebhookServer.handleRequest(createTestRequest(payload));
// Verify the three command-related log calls
expect(consoleSpy).toHaveBeenCalledTimes(3);
// Verify the two command-related log calls (first log is skipped in test mode)
expect(consoleSpy).toHaveBeenCalledTimes(2);
expect(consoleSpy).toHaveBeenCalledWith(
' Incoming webhook request:'
);
// First call should be the command detection
expect(consoleSpy.mock.calls[0][0]).toBe('🔍 Detected /tarea command:');
expect(consoleSpy.mock.calls[0][1]).toEqual({
timestamp: expect.any(String),
from: 'user123@s.whatsapp.net',
group: 'group123@g.us',
rawMessage: '/tarea nueva Finish project @user2 2025-04-30'
});
expect(consoleSpy).toHaveBeenCalledWith(
'🔍 Detected /tarea command:',
expect.objectContaining({
from: 'user123@s.whatsapp.net',
group: 'group123@g.us',
rawMessage: '/tarea nueva Finish project @user2 2025-04-30'
})
);
expect(consoleSpy).toHaveBeenCalledWith(
'✅ Successfully parsed command:',
expect.objectContaining({
action: 'nueva',
description: 'Finish project @user2',
dueDate: '2025-04-30',
mentionCount: expect.any(Number)
})
);
// Second call should be the successful parsing
expect(consoleSpy.mock.calls[1][0]).toBe('✅ Successfully parsed command:');
expect(consoleSpy.mock.calls[1][1]).toEqual({
action: 'nueva',
description: 'Finish project @user2',
dueDate: '2025-04-30',
mentionCount: 1
});
});
});

Loading…
Cancel
Save