generated from custom-cards/boilerplate-card
-
-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add
microphone_disconnect
action (#1536)
- Loading branch information
Showing
7 changed files
with
74 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { GeneralActionConfig } from '../../../config/types'; | ||
import { CardActionsAPI } from '../../types'; | ||
import { FrigateCardAction } from './base'; | ||
|
||
export class MicrophoneDisconnectAction extends FrigateCardAction<GeneralActionConfig> { | ||
public async execute(api: CardActionsAPI): Promise<void> { | ||
api.getMicrophoneManager().disconnect(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
tests/card-controller/actions/actions/microphone-disconnect.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { expect, it } from 'vitest'; | ||
import { MicrophoneDisconnectAction } from '../../../../src/card-controller/actions/actions/microphone-disconnect'; | ||
import { createCardAPI } from '../../../test-utils'; | ||
|
||
it('should handle microphone_disconnect action', async () => { | ||
const api = createCardAPI(); | ||
const action = new MicrophoneDisconnectAction( | ||
{}, | ||
{ | ||
action: 'fire-dom-event', | ||
frigate_card_action: 'microphone_disconnect', | ||
}, | ||
); | ||
|
||
await action.execute(api); | ||
|
||
expect(api.getMicrophoneManager().disconnect).toBeCalled(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters