1
0
mirror of https://github.com/home-assistant/frontend.git synced 2026-04-19 08:20:41 +01:00

Add more tests for common/entity (#24336)

* Use substring instead of deprecated substr

* Add more common entity tests
This commit is contained in:
Wendelin
2025-02-20 20:11:53 +01:00
committed by GitHub
parent 400106ec09
commit 0a05dd8f71
9 changed files with 558 additions and 9 deletions

View File

@@ -63,4 +63,28 @@ describe("canToggleState", () => {
};
assert.isFalse(canToggleState(hass, stateObj));
});
it("Detects group with missing entity", () => {
const stateObj: any = {
entity_id: "group.bla",
state: "on",
attributes: {
entity_id: ["light.non_existing"],
},
};
assert.isFalse(canToggleState(hass, stateObj));
});
it("Detects group with off state", () => {
const stateObj: any = {
entity_id: "group.bla",
state: "off",
attributes: {
entity_id: ["light.test"],
},
};
assert.isTrue(canToggleState(hass, stateObj));
});
});