From 1b0eb6ab53219f236ab5dd938e1a561c9bc2eae6 Mon Sep 17 00:00:00 2001 From: Lovell Fuller Date: Thu, 29 Sep 2022 14:21:37 +0100 Subject: [PATCH] Tests: add assertion to existing scenario #3357 --- test/unit/png.js | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/test/unit/png.js b/test/unit/png.js index bda0d098..a2933853 100644 --- a/test/unit/png.js +++ b/test/unit/png.js @@ -128,11 +128,25 @@ describe('PNG', function () { assert.strictEqual(alphaMeanAfter, alphaMeanBefore); }); - it('palette decode/encode roundtrip', () => - sharp(fixtures.inputPngPalette) + it('palette decode/encode roundtrip', async () => { + const data = await sharp(fixtures.inputPngPalette) .png({ effort: 1, palette: true }) - .toBuffer() - ); + .toBuffer(); + + const { size, ...metadata } = await sharp(data).metadata(); + assert.deepStrictEqual(metadata, { + format: 'png', + width: 68, + height: 68, + space: 'srgb', + channels: 3, + depth: 'uchar', + isProgressive: false, + paletteBitDepth: 8, + hasProfile: false, + hasAlpha: false + }); + }); it('Valid PNG libimagequant palette value does not throw error', function () { assert.doesNotThrow(function () {