mirror of
https://github.com/snapotter-hq/SnapOtter.git
synced 2026-08-03 07:46:42 +02:00
fix: make dead zone test deterministic and remove unused parameter
Replace Math.random() with deterministic modular arithmetic to prevent flaky CI failures. Remove unused index parameter from Array.from callback.
This commit is contained in:
@@ -105,9 +105,7 @@ describe("analyzeImage", () => {
|
||||
// Wide spread centered at 128 gives stdev ~60 (contrast ~50) and mean ~128 (exposure ~50).
|
||||
// Both scores land inside the [40,60] dead zone, so corrections should be zero.
|
||||
const midGrayBuffer = await sharp(
|
||||
Buffer.from(
|
||||
Array.from({ length: 100 * 100 * 3 }, (_, i) => 24 + Math.floor(Math.random() * 208)),
|
||||
),
|
||||
Buffer.from(Array.from({ length: 100 * 100 * 3 }, (_, i) => 24 + ((i * 97) % 208))),
|
||||
{ raw: { width: 100, height: 100, channels: 3 } },
|
||||
)
|
||||
.png()
|
||||
|
||||
Reference in New Issue
Block a user