mirror of
https://github.com/home-assistant/frontend.git
synced 2025-12-20 02:38:53 +00:00
* Organize files * Import EventsMixin * Import NavigateMixin * Dissolve window.hassMixins * Apply ElementMixin when we use it * Update tests to point at right dir * Eslint * Clean * Update mixins inside hassio * Update lint command" * Fix polymer lint
40 lines
897 B
JavaScript
40 lines
897 B
JavaScript
import { assert } from 'chai';
|
|
|
|
import canToggleDomain from '../../../src/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'));
|
|
});
|
|
});
|