From a9eb90f457287e6c28dc61c5c3f5a473654603a6 Mon Sep 17 00:00:00 2001 From: Gabriel Brown Date: Mon, 17 Aug 2026 19:21:17 -0400 Subject: [PATCH] Fix Home Assistant composition contract --- tests/quickshell/home_assistant_bridge_test.py | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/tests/quickshell/home_assistant_bridge_test.py b/tests/quickshell/home_assistant_bridge_test.py index 6a1b329..b9e5002 100644 --- a/tests/quickshell/home_assistant_bridge_test.py +++ b/tests/quickshell/home_assistant_bridge_test.py @@ -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(