This commit is contained in:
Giancarmine Salucci
2026-02-18 01:21:44 +01:00
parent 54321fd7c9
commit 49bccf8f15
84 changed files with 14474 additions and 13925 deletions

View File

@@ -24,18 +24,13 @@ describe('tandoor logging', () => {
name: 'Test Recipe',
servings: 4,
description: 'Test description',
ingredients: [
{ item: 'Flour', amount: '2', unit: 'cups' }
],
ingredients: [{ item: 'Flour', amount: '2', unit: 'cups' }],
steps: ['Mix ingredients']
};
await uploadRecipeWithIngredientsDTO(recipe);
expect(logErrorSpy).toHaveBeenCalledWith(
'[Tandoor] Fetch error',
expect.any(Error)
);
expect(logErrorSpy).toHaveBeenCalledWith('[Tandoor] Fetch error', expect.any(Error));
});
test('should use logError on API error response', async () => {
@@ -80,10 +75,7 @@ describe('tandoor logging', () => {
await uploadRecipeWithIngredientsDTO(recipe);
expect(logErrorSpy).toHaveBeenCalledWith(
'[Tandoor] Fetch error',
expect.any(Error)
);
expect(logErrorSpy).toHaveBeenCalledWith('[Tandoor] Fetch error', expect.any(Error));
});
test('should use logError on image upload failure', async () => {
@@ -93,10 +85,7 @@ describe('tandoor logging', () => {
const result = await uploadRecipeImage(123, 'https://example.com/image.jpg');
expect(result.success).toBe(false);
expect(logErrorSpy).toHaveBeenCalledWith(
'[Tandoor Upload] Exception',
error
);
expect(logErrorSpy).toHaveBeenCalledWith('[Tandoor Upload] Exception', error);
});
test('should use logError instead of manual error logging', async () => {
@@ -112,11 +101,8 @@ describe('tandoor logging', () => {
});
// Verify logError was called (which handles stack trace serialization)
expect(logErrorSpy).toHaveBeenCalledWith(
'[Tandoor] Fetch error',
error
);
expect(logErrorSpy).toHaveBeenCalledWith('[Tandoor] Fetch error', error);
// logError itself logs stack traces, which is expected behavior
// The key is that tandoor.ts uses logError instead of manual logging
});