diff --git a/src/utils/imageProcessor.test.ts b/src/utils/imageProcessor.test.ts index fcd6bddc..b98e2f00 100644 --- a/src/utils/imageProcessor.test.ts +++ b/src/utils/imageProcessor.test.ts @@ -9,8 +9,16 @@ const mocks = vi.hoisted(() => { const resize = vi.fn(() => ({ webp })); 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 { - sharp: vi.fn(() => sharpInstance), + sharp, resize, webp, toFile, diff --git a/src/utils/imageProcessor.ts b/src/utils/imageProcessor.ts index 87ed7ed6..d3f1cbb0 100644 --- a/src/utils/imageProcessor.ts +++ b/src/utils/imageProcessor.ts @@ -41,6 +41,12 @@ export async function generateFlyerIcon(sourceImagePath: string, iconsDirectory: return iconFileName; } catch (error) { 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.'); } } \ No newline at end of file