mirror of
https://github.com/home-assistant/frontend.git
synced 2025-12-24 20:55:49 +00:00
* Use new version of HAWS * Fix init page * Lint * Fix tests * Update gitignore * Clear old tokens, use new key to store
38 lines
850 B
JavaScript
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'));
|
|
});
|
|
});
|