From 07c9718bc3b1bd654fc1aed20890ddde397d21c1 Mon Sep 17 00:00:00 2001 From: David Montero Crespo Date: Tue, 21 Apr 2026 17:31:51 -0300 Subject: [PATCH] test: update BMP280 chip ID assertions and clarify tagName uniqueness in metadata drift test --- test/backend/unit/test_i2c_slaves.py | 6 +++--- test/test_circuit/test/metadata_drift.test.js | 9 ++++----- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/test/backend/unit/test_i2c_slaves.py b/test/backend/unit/test_i2c_slaves.py index 368d48e8..90825678 100644 --- a/test/backend/unit/test_i2c_slaves.py +++ b/test/backend/unit/test_i2c_slaves.py @@ -105,7 +105,7 @@ class TestBMP280Slave(unittest.TestCase): def test_chip_id_register_0xd0(self): chip_id = i2c_read_seq(self.slave, 0xD0, 1)[0] - self.assertEqual(chip_id, 0x60, 'chip_id must be 0x60 for BMP280') + self.assertEqual(chip_id, 0x58, 'chip_id must be 0x58 for BMP280') # ── Calibration registers ────────────────────────────────────────────────── @@ -178,7 +178,7 @@ class TestBMP280Slave(unittest.TestCase): self.slave.handle_event(I2C_FINISH) self.slave.handle_event(I2C_START_RECV) val = self.slave.handle_event(I2C_READ) - self.assertEqual(val, 0x60) + self.assertEqual(val, 0x58) def test_finish_resets_first_byte_flag(self): """After FINISH, the next transaction's first WRITE must set reg_ptr.""" @@ -191,7 +191,7 @@ class TestBMP280Slave(unittest.TestCase): self.slave.handle_event(I2C_FINISH) self.slave.handle_event(I2C_START_RECV) val = self.slave.handle_event(I2C_READ) - self.assertEqual(val, 0x60, 'chip_id should still be 0x60 after FINISH + new transaction') + self.assertEqual(val, 0x58, 'chip_id should still be 0x58 after FINISH + new transaction') # ══════════════════════════════════════════════════════════════════════════════ diff --git a/test/test_circuit/test/metadata_drift.test.js b/test/test_circuit/test/metadata_drift.test.js index 71e7f1a3..300aef77 100644 --- a/test/test_circuit/test/metadata_drift.test.js +++ b/test/test_circuit/test/metadata_drift.test.js @@ -65,11 +65,10 @@ describe('component-overrides → components-metadata drift detector', () => { } }); - it('all _customComponents tagNames are unique (no collisions)', () => { - const tagNames = custom.map(c => c.tagName); - const dupes = tagNames.filter((t, i) => tagNames.indexOf(t) !== i); - expect(dupes, `Duplicate tagNames: ${dupes.join(', ')}`).toEqual([]); - }); + // NOTE: tagName is intentionally NOT required to be unique — multiple value + // variants (e.g. cap-10p, cap-22p, cap-100n) share the same Web Component tag + // (`wokwi-capacitor`) but differ in id and default attribute values. The id + // uniqueness check below is the actual collision guard. it('all _customComponents ids are unique', () => { const ids = custom.map(c => c.id);