From 30a460e45dba70eebd7ea6a5eaa20bd4280eeac4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Zasso?= Date: Fri, 25 Jul 2025 09:10:39 +0200 Subject: [PATCH 1/2] test: fix encodeBmp equality checks --- src/save/__tests__/encodeBmp.test.ts | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/src/save/__tests__/encodeBmp.test.ts b/src/save/__tests__/encodeBmp.test.ts index 8a1f20ee9..9ec61d358 100644 --- a/src/save/__tests__/encodeBmp.test.ts +++ b/src/save/__tests__/encodeBmp.test.ts @@ -12,11 +12,9 @@ test('encode 5x5 mask', () => { ]); const mask = image.threshold({ threshold: 0.5 }); const result = testUtils.loadBuffer('formats/bmp/5x5.bmp'); - const buffer = encodeBmp(mask).buffer; + const buffer = encodeBmp(mask); - // TODO: change to `toStrictEqual`. - // eslint-disable-next-line vitest/prefer-strict-equal - expect(buffer).toEqual(result.buffer); + expect(buffer).toStrictEqual(result); }); test('encode 6x4 mask', () => { @@ -28,11 +26,9 @@ test('encode 6x4 mask', () => { ]); const mask = image.threshold({ threshold: 0.5 }); const result = testUtils.loadBuffer('formats/bmp/6x4.bmp'); - const buffer = encodeBmp(mask).buffer; + const buffer = encodeBmp(mask); - // TODO: change to `toStrictEqual`. - // eslint-disable-next-line vitest/prefer-strict-equal - expect(buffer).toEqual(result.buffer); + expect(buffer).toStrictEqual(result); }); test('encode 10x2 mask', () => { @@ -42,11 +38,9 @@ test('encode 10x2 mask', () => { ]); const mask = image.threshold({ threshold: 0.5 }); const result = testUtils.loadBuffer('formats/bmp/10x2.bmp'); - const buffer = encodeBmp(mask).buffer; + const buffer = encodeBmp(mask); - // TODO: change to `toStrictEqual`. - // eslint-disable-next-line vitest/prefer-strict-equal - expect(buffer).toEqual(result.buffer); + expect(buffer).toStrictEqual(result); }); test('should throw error', () => { From 4f859e533a47474d4813b4c6382ce2f146d4fcac Mon Sep 17 00:00:00 2001 From: EscapedGibbon Date: Fri, 25 Jul 2025 13:38:05 +0200 Subject: [PATCH 2/2] test: update images so they align with GIMP encoding --- test/img/formats/bmp/10x2.bmp | Bin 154 -> 154 bytes test/img/formats/bmp/5x5.bmp | Bin 166 -> 166 bytes test/img/formats/bmp/6x4.bmp | Bin 162 -> 162 bytes 3 files changed, 0 insertions(+), 0 deletions(-) diff --git a/test/img/formats/bmp/10x2.bmp b/test/img/formats/bmp/10x2.bmp index d1378782593eefba934c5f159ffc754d03fe2faf..daa23a3826d11e98d018bbc5b2857cfcacd2ba2e 100644 GIT binary patch delta 61 zcmbQmIE!(Dnu;(t0|N*%F+eZ_!+#h8iZC!Zxd#dGDE3lK8`AqWV7NeICNq(B%5{v#m