test: update BMP280 chip ID assertions and clarify tagName uniqueness in metadata drift test

This commit is contained in:
David Montero Crespo 2026-04-21 17:31:51 -03:00
parent ff918375d7
commit 07c9718bc3
2 changed files with 7 additions and 8 deletions

View File

@ -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')
# ══════════════════════════════════════════════════════════════════════════════

View File

@ -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);