1
0
mirror of https://github.com/home-assistant/frontend.git synced 2025-12-24 20:55:49 +00:00
Files
frontend/test-mocha/common/entity/can_toggle_domain_test.js
Paulus Schoutsen 45cdb5a3e4 Use new version of HAWS (#1612)
* Use new version of HAWS

* Fix init page

* Lint

* Fix tests

* Update gitignore

* Clear old tokens, use new key to store
2018-08-31 09:45:58 +02:00

38 lines
850 B
JavaScript

import { assert } from 'chai';
import canToggleDomain from '../../../src/common/entity/can_toggle_domain';
describe('canToggleDomain', () => {
const hass = {
services: {
light: {
turn_on: null, // Service keys only need to be present for test
turn_off: null,
},
lock: {
lock: null,
unlock: null,
},
sensor: {
custom_service: null,
},
},
};
it('Detects lights toggle', () => {
assert.isTrue(canToggleDomain(hass, 'light'));
});
it('Detects locks toggle', () => {
assert.isTrue(canToggleDomain(hass, 'lock'));
});
it('Detects sensors do not toggle', () => {
assert.isFalse(canToggleDomain(hass, 'sensor'));
});
it('Detects binary sensors do not toggle', () => {
assert.isFalse(canToggleDomain(hass, 'binary_sensor'));
});
});