1
0
mirror of https://github.com/home-assistant/frontend.git synced 2025-12-20 02:38:53 +00:00
Files
frontend/test-mocha/common/entity/can_toggle_domain_test.js
Paulus Schoutsen 912969111f Move all of hassUtil to JS (#1153)
* Move all of hassUtil to JS

* Fix tests
2018-05-09 21:33:31 -04:00

40 lines
896 B
JavaScript

import { assert } from 'chai';
import canToggleDomain from '../../../js/common/entity/can_toggle_domain';
describe('canToggleDomain', () => {
const hass = {
config: {
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'));
});
});