From b5b796bf17042979e862a3dba753eb3e0ecb435f Mon Sep 17 00:00:00 2001 From: Kiril Vatev Date: Sun, 3 Dec 2023 02:29:13 -0500 Subject: [PATCH] using flat confetti to make sure scale tests are more stable and repeatable --- test/index.test.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/test/index.test.js b/test/index.test.js index 2af58ca..4e6ff5a 100644 --- a/test/index.test.js +++ b/test/index.test.js @@ -377,13 +377,16 @@ test('shoots default scaled confetti', async t => { t.context.buffer = await confettiImage(page, { colors: ['#0000ff'], shapes: ['circle'], - particleCount: 10 + particleCount: 1, + startVelocity: 0, + gravity: 0, + flat: true }); t.context.image = await removeOpacity(t.context.buffer); const pixels = await totalPixels(t.context.image); - t.is(pixels > 100 && pixels < 500, true); + t.is(pixels, 124); }); test('shoots larger scaled confetti', async t => { @@ -393,13 +396,16 @@ test('shoots larger scaled confetti', async t => { colors: ['#0000ff'], shapes: ['circle'], scalar: 10, - particleCount: 10 + particleCount: 1, + startVelocity: 0, + gravity: 0, + flat: true }); t.context.image = await removeOpacity(t.context.buffer); const pixels = await totalPixels(t.context.image); - t.is(pixels > 2000, true); + t.is(pixels, 11476); }); test('shoots confetti to the left', async t => {