feat: Add microphone_connect action (#1537)

This commit is contained in:
Felipe Santos
2024-09-15 20:17:48 -07:00
committed by GitHub
parent 03ff02083d
commit af4666e023
7 changed files with 67 additions and 25 deletions
@@ -0,0 +1,18 @@
import { expect, it } from 'vitest';
import { MicrophoneConnectAction } from '../../../../src/card-controller/actions/actions/microphone-connect';
import { createCardAPI } from '../../../test-utils';
it('should handle microphone_connect action', async () => {
const api = createCardAPI();
const action = new MicrophoneConnectAction(
{},
{
action: 'fire-dom-event',
frigate_card_action: 'microphone_connect',
},
);
await action.execute(api);
expect(api.getMicrophoneManager().connect).toBeCalled();
});
@@ -10,6 +10,7 @@ import { GenericAction } from '../../../src/card-controller/actions/actions/gene
import { LogAction } from '../../../src/card-controller/actions/actions/log';
import { MediaPlayerAction } from '../../../src/card-controller/actions/actions/media-player';
import { MenuToggleAction } from '../../../src/card-controller/actions/actions/menu-toggle';
import { MicrophoneConnectAction } from '../../../src/card-controller/actions/actions/microphone-connect';
import { MicrophoneDisconnectAction } from '../../../src/card-controller/actions/actions/microphone-disconnect';
import { MicrophoneMuteAction } from '../../../src/card-controller/actions/actions/microphone-mute';
import { MicrophoneUnmuteAction } from '../../../src/card-controller/actions/actions/microphone-unmute';
@@ -104,6 +105,7 @@ describe('ActionFactory', () => {
MediaPlayerAction,
],
[{ frigate_card_action: 'menu_toggle' as const }, MenuToggleAction],
[{ frigate_card_action: 'microphone_connect' as const }, MicrophoneConnectAction],
[
{ frigate_card_action: 'microphone_disconnect' as const },
MicrophoneDisconnectAction,