Fix Home Assistant composition contract

This commit is contained in:
Gabriel Brown
2026-08-17 19:21:17 -04:00
parent b5c9156e64
commit a9eb90f457
+13 -3
View File
@@ -255,11 +255,21 @@ class HomeAssistantBridgeTest(unittest.TestCase):
def test_qml_refreshes_through_the_catalog_command(self) -> None:
self.assertIn('command: [root.helperPath, "catalog"]', QML_SERVICE.read_text())
def test_qml_adapts_catalog_entities_for_legacy_consumers(self) -> None:
def test_qml_composes_catalog_and_preferences_for_selected_entities(self) -> None:
source = QML_SERVICE.read_text()
self.assertIn("result.entities.map(entity => Object.assign({}, entity, {", source)
self.assertIn('name: entity.sourceName, domain: "light"', source)
self.assertIn(
"root.catalog = Array.isArray(result.entities) ? result.entities : [];",
source,
)
self.assertIn(
"const favorites = root.fixtureMode\n"
" ? root.fixtureFavorites\n"
" : HomePreferences.favorites;",
source,
)
self.assertIn("name: alias || entity.sourceName,", source)
self.assertIn("root.selectedEntities = nextSelection;", source)
def test_authentication_error_is_redacted(self) -> None:
self.assertEqual(