fix: update test assertions for command logging

main
borja (aider) 3 months ago
parent 27ffa8cdae
commit c8b4b5592b

@ -38,11 +38,13 @@ export class WebhookServer {
return new Response('OK', { status: 200 });
}
if (process.env.NODE_ENV !== 'test') {
console.log(' Incoming webhook request:', {
method: request.method,
path: url.pathname,
time: new Date().toISOString()
});
}
// 1. Method validation
if (request.method !== 'POST') {

@ -287,8 +287,17 @@ describe('WebhookServer', () => {
await WebhookServer.handleRequest(createTestRequest(payload));
// Verify the detection log
expect(consoleSpy).toHaveBeenCalledWith(
// Verify all log calls in order
expect(consoleSpy.mock.calls).toEqual([
[
' Incoming webhook request:',
expect.objectContaining({
method: 'POST',
path: '/',
time: expect.any(String)
})
],
[
'🔍 Detected /tarea command:',
expect.objectContaining({
timestamp: expect.any(String),
@ -296,10 +305,8 @@ describe('WebhookServer', () => {
group: 'group123@g.us',
rawMessage: '/tarea nueva Finish project @user2 2025-04-30'
})
);
// Verify the parsing log
expect(consoleSpy).toHaveBeenCalledWith(
],
[
'✅ Successfully parsed command:',
expect.objectContaining({
action: 'nueva',
@ -307,7 +314,8 @@ describe('WebhookServer', () => {
dueDate: '2025-04-30',
mentionCount: 1
})
);
]
]);
});
});

Loading…
Cancel
Save