From 95a60e1d016fcb6473198a3bf62f5b6a153d6acf Mon Sep 17 00:00:00 2001 From: David Montero Crespo Date: Tue, 19 May 2026 18:29:21 -0300 Subject: [PATCH] test: align photoresistor-sensor fixtures + snapshots with 603b791 alias MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Three failures introduced by 603b791 (which added MAPPERS['photoresistor-sensor'] = MAPPERS['photoresistor'] so the metadata-id 'photoresistor-sensor' resolves to a SPICE mapper): - component-to-spice.test.ts "every mapped metadataId has a test fixture" flagged photoresistor-sensor as missing. Added a fixture entry that mirrors the photoresistor one — the part is electrically identical. - examples-netlist-snapshot.test.ts > photoresistor-light and > nano-sensor-station snapshots now contain R_ldr_ldr + R_ldr_pull cards (correct LDR + 10k pull) instead of the previous R_autopull_n0 100M stub. This is the intended behaviour change: before the alias the LDR was unmapped and the netlist autopulled the net to ground with a 100M dummy; after the alias the SPICE deck carries the real divider topology. Regenerated only these two snapshot entries (vitest -u on the single file). No production code changes. Co-Authored-By: Claude Opus 4.7 --- .../__snapshots__/examples-netlist-snapshot.test.ts.snap | 6 ++++-- frontend/src/__tests__/component-to-spice.test.ts | 4 ++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/frontend/src/__tests__/__snapshots__/examples-netlist-snapshot.test.ts.snap b/frontend/src/__tests__/__snapshots__/examples-netlist-snapshot.test.ts.snap index 4edf4697..bab9cd80 100644 --- a/frontend/src/__tests__/__snapshots__/examples-netlist-snapshot.test.ts.snap +++ b/frontend/src/__tests__/__snapshots__/examples-netlist-snapshot.test.ts.snap @@ -1392,7 +1392,8 @@ exports[`netlist snapshot — circuits (40 examples) > nano-sensor-station 1`] = V_VCC_RAIL vcc_rail 0 DC 5 R_ntc_ntc vcc_rail n1 11441.484668193882 R_ntc_pull n1 0 10000 -R_autopull_n0 n0 0 100Meg +R_ldr_ldr vcc_rail n0 400000 +R_ldr_pull n0 0 10000 .op .end" `; @@ -1754,7 +1755,8 @@ R_autopull_n2 n2 0 100Meg exports[`netlist snapshot — circuits (40 examples) > photoresistor-light 1`] = ` "* Velxio circuit V_VCC_RAIL vcc_rail 0 DC 5 -R_autopull_n0 n0 0 100Meg +R_ldr_ldr vcc_rail n0 285714.28571428574 +R_ldr_pull n0 0 10000 .op .end" `; diff --git a/frontend/src/__tests__/component-to-spice.test.ts b/frontend/src/__tests__/component-to-spice.test.ts index 66b36b40..d0e6351a 100644 --- a/frontend/src/__tests__/component-to-spice.test.ts +++ b/frontend/src/__tests__/component-to-spice.test.ts @@ -97,6 +97,10 @@ const MINIMAL_FIXTURES: Record = { potentiometer: { pins: ['VCC', 'SIG', 'GND'], properties: { min: 0, max: 1023, value: 512 } }, 'ntc-temperature-sensor': { pins: ['VCC', 'OUT', 'GND'], properties: { temperature: 25 } }, photoresistor: { pins: ['VCC', 'AO', 'GND'], properties: { lux: 500 } }, + // Same physical part as `photoresistor`, exposed under the alias metadataId + // the components-metadata generator emits. The SPICE mapper for both is + // identical (componentToSpice.ts:MAPPERS['photoresistor-sensor'] = MAPPERS['photoresistor']). + 'photoresistor-sensor': { pins: ['VCC', 'AO', 'GND'], properties: { lux: 500 } }, 'instr-voltmeter': { pins: ['V+', 'V-'] }, 'instr-ammeter': { pins: ['A+', 'A-'] }, // Logic gates drive Y via a B-source. Drive inputs to VCC (high), observe