From 022b577922487c513d88d42d92552e011ad74305 Mon Sep 17 00:00:00 2001 From: Tom Boucher Date: Sun, 26 Apr 2026 11:36:14 -0400 Subject: [PATCH] test(graphify): tighten version-check assertions per CodeRabbit nitpick - Success path: add explicit python3Calls.length === 0 assertion so "no fallback" is stated directly rather than implied by calls.length === 1 - Fallback path: add explicit calls[0].cmd === 'graphify' assertion so "graphify precedes python3" is verified by name, not just argument --- tests/graphify.test.cjs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/graphify.test.cjs b/tests/graphify.test.cjs index 2cf697400..e1ec51d3d 100644 --- a/tests/graphify.test.cjs +++ b/tests/graphify.test.cjs @@ -395,6 +395,8 @@ describe('checkGraphifyVersion', () => { assert.strictEqual(calls.length, 1, 'exactly one spawnSync call — no python3 fallback'); assert.strictEqual(calls[0].cmd, 'graphify'); assert.ok(calls[0].args.includes('--version'), 'graphify called with --version'); + const python3Calls = calls.filter(c => c.cmd === 'python3'); + assert.strictEqual(python3Calls.length, 0, 'no python3 fallback when graphify --version succeeds'); }); test('falls back to python3 importlib.metadata when graphify --version fails', () => { @@ -412,6 +414,7 @@ describe('checkGraphifyVersion', () => { assert.strictEqual(result.version, '0.4.3'); assert.strictEqual(result.compatible, true); assert.ok(calls.length >= 2, 'at least two spawnSync calls (graphify attempt + python3 fallback)'); + assert.strictEqual(calls[0].cmd, 'graphify', 'graphify call precedes python3 fallback'); assert.ok(calls[0].args.includes('--version'), 'graphify --version attempted first'); const lastCall = calls[calls.length - 1]; assert.strictEqual(lastCall.cmd, 'python3', 'python3 fallback fires last');