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:
@@ -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));
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user