From ef89ce56858c1705f750e97fd41620e4ec9107c7 Mon Sep 17 00:00:00 2001 From: Alex J Burke Date: Fri, 15 Dec 2023 16:01:40 +0100 Subject: [PATCH] Cover an OutputDimensionsExceeded error being passed to next. --- test/processImage.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/test/processImage.js b/test/processImage.js index 361d6fc..1532d67 100644 --- a/test/processImage.js +++ b/test/processImage.js @@ -1274,6 +1274,22 @@ describe('express-processimage', () => { }), }); }); + + it('should refuse to resize an image to exceed the max number of pixels', () => { + config.maxOutputPixels = 2; + return expect( + 'GET /bulb.gif?resize=100,100', + 'to yield response', + { + errorPassedToNext: expect.it('to satisfy', { + message: + 'resize: Target dimensions of 100x100 exceed maxOutputPixels (2)', + name: 'OutputDimensionsExceeded', + OutputDimensionsExceeded: true, + }), + } + ); + }); }); }); });