fix logging tests
All checks were successful
Deploy to Web Server flyer-crawler.projectium.com / deploy (push) Successful in 5m53s
All checks were successful
Deploy to Web Server flyer-crawler.projectium.com / deploy (push) Successful in 5m53s
This commit is contained in:
@@ -9,8 +9,16 @@ const mocks = vi.hoisted(() => {
|
|||||||
const resize = vi.fn(() => ({ webp }));
|
const resize = vi.fn(() => ({ webp }));
|
||||||
const sharpInstance = { resize };
|
const sharpInstance = { resize };
|
||||||
|
|
||||||
|
// Mock the sharp function and attach static properties required by the implementation
|
||||||
|
const sharp = vi.fn(() => sharpInstance);
|
||||||
|
Object.assign(sharp, {
|
||||||
|
fit: {
|
||||||
|
cover: 'cover',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
return {
|
return {
|
||||||
sharp: vi.fn(() => sharpInstance),
|
sharp,
|
||||||
resize,
|
resize,
|
||||||
webp,
|
webp,
|
||||||
toFile,
|
toFile,
|
||||||
|
|||||||
@@ -41,6 +41,12 @@ export async function generateFlyerIcon(sourceImagePath: string, iconsDirectory:
|
|||||||
return iconFileName;
|
return iconFileName;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
logger.error('Failed to generate flyer icon:', { error, sourceImagePath });
|
logger.error('Failed to generate flyer icon:', { error, sourceImagePath });
|
||||||
|
// Add logging to ensure the underlying error is visible in test output or server logs
|
||||||
|
if (error instanceof Error) {
|
||||||
|
console.error('Error generating icon:', error.message, error.stack);
|
||||||
|
} else {
|
||||||
|
console.error('Error generating icon:', error);
|
||||||
|
}
|
||||||
throw new Error('Icon generation failed.');
|
throw new Error('Icon generation failed.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user