simplify
This commit is contained in:
@@ -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
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user