43 lines
1.1 KiB
TypeScript
43 lines
1.1 KiB
TypeScript
import { expect, it } from 'vitest';
|
|
|
|
import { CallStartAction } from '../../../../src/card-controller/actions/actions/call-start';
|
|
import { createCardAPI } from '../../../test-utils';
|
|
|
|
it('should handle call_start action without a camera or stream', async () => {
|
|
const api = createCardAPI();
|
|
const action = new CallStartAction(
|
|
{},
|
|
{
|
|
action: 'fire-dom-event',
|
|
advanced_camera_card_action: 'call_start',
|
|
},
|
|
);
|
|
|
|
await action.execute(api);
|
|
|
|
expect(api.getCallManager().start).toHaveBeenCalledWith({
|
|
cameraID: undefined,
|
|
streamID: undefined,
|
|
});
|
|
});
|
|
|
|
it('should handle call_start action with a camera and stream', async () => {
|
|
const api = createCardAPI();
|
|
const action = new CallStartAction(
|
|
{},
|
|
{
|
|
action: 'fire-dom-event',
|
|
advanced_camera_card_action: 'call_start',
|
|
camera: 'camera.front',
|
|
stream: 'camera.front_doorbell',
|
|
},
|
|
);
|
|
|
|
await action.execute(api);
|
|
|
|
expect(api.getCallManager().start).toHaveBeenCalledWith({
|
|
cameraID: 'camera.front',
|
|
streamID: 'camera.front_doorbell',
|
|
});
|
|
});
|