From f841fa9b0b363c5f5b097ff528eccc576a06eab0 Mon Sep 17 00:00:00 2001 From: Kiril Vatev Date: Sun, 3 Dec 2023 02:50:42 -0500 Subject: [PATCH] allowing pixel values to be off by 1% due to rendering differences on operating systems --- test/index.test.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/test/index.test.js b/test/index.test.js index 4e6ff5a..ac161d9 100644 --- a/test/index.test.js +++ b/test/index.test.js @@ -386,7 +386,8 @@ test('shoots default scaled confetti', async t => { const pixels = await totalPixels(t.context.image); - t.is(pixels, 124); + const expected = 124; + t.true(pixels > expected * .99 && pixels < expected * 1.01, `${pixels}±1% ≠ ${expected}`); }); test('shoots larger scaled confetti', async t => { @@ -405,7 +406,8 @@ test('shoots larger scaled confetti', async t => { const pixels = await totalPixels(t.context.image); - t.is(pixels, 11476); + const expected = 11476; + t.true(pixels > expected * .99 && pixels < expected * 1.01, `${pixels} ± 1% ≠ ${expected}`); }); test('shoots confetti to the left', async t => {