fix: Substream only cameras should not be triggerable (#1848)
- Closes #1846
This commit is contained in:
@@ -81,6 +81,9 @@ describe('Camera', () => {
|
||||
},
|
||||
}),
|
||||
new GenericCameraManagerEngine(mock<StateWatcherSubscriptionInterface>()),
|
||||
{
|
||||
capabilities: createCapabilities({ trigger: true }),
|
||||
},
|
||||
);
|
||||
|
||||
const stateWatcher = mock<StateWatcherSubscriptionInterface>();
|
||||
@@ -117,7 +120,10 @@ describe('Camera', () => {
|
||||
},
|
||||
}),
|
||||
new GenericCameraManagerEngine(mock<StateWatcherSubscriptionInterface>()),
|
||||
{ eventCallback: eventCallback },
|
||||
{
|
||||
capabilities: createCapabilities({ trigger: true }),
|
||||
eventCallback: eventCallback,
|
||||
},
|
||||
);
|
||||
|
||||
const stateWatcher = mock<StateWatcherSubscriptionInterface>();
|
||||
@@ -125,6 +131,8 @@ describe('Camera', () => {
|
||||
stateWatcher: stateWatcher,
|
||||
});
|
||||
|
||||
expect(stateWatcher.subscribe).toBeCalled();
|
||||
|
||||
const diff = {
|
||||
entityID: 'sensor.force_update',
|
||||
oldState: createStateEntity({ state: stateFrom }),
|
||||
@@ -138,6 +146,30 @@ describe('Camera', () => {
|
||||
});
|
||||
},
|
||||
);
|
||||
|
||||
it('should not trigger without trigger capability', async () => {
|
||||
const eventCallback = vi.fn();
|
||||
const camera = new Camera(
|
||||
createCameraConfig({
|
||||
id: 'camera_1',
|
||||
triggers: {
|
||||
entities: ['binary_sensor.foo'],
|
||||
},
|
||||
}),
|
||||
new GenericCameraManagerEngine(mock<StateWatcherSubscriptionInterface>()),
|
||||
{
|
||||
capabilities: createCapabilities({ trigger: false }),
|
||||
eventCallback: eventCallback,
|
||||
},
|
||||
);
|
||||
|
||||
const stateWatcher = mock<StateWatcherSubscriptionInterface>();
|
||||
await camera.initialize({
|
||||
stateWatcher: stateWatcher,
|
||||
});
|
||||
|
||||
expect(stateWatcher.subscribe).not.toBeCalled();
|
||||
});
|
||||
});
|
||||
|
||||
describe('should get proxy config', () => {
|
||||
|
||||
Reference in New Issue
Block a user