File tree Expand file tree Collapse file tree 2 files changed +27
-4
lines changed
Expand file tree Collapse file tree 2 files changed +27
-4
lines changed Original file line number Diff line number Diff line change @@ -3815,6 +3815,33 @@ describe('AntMedia Component', () => {
38153815
38163816 consoleSpy . mockRestore ( ) ;
38173817 } ) ;
3818+
3819+ describe ( 'checkAndTurnOffLocalCamera' , ( ) => {
3820+ it ( 'should call webRTCAdaptor.turnOffLocalCamera with the correct stream id' , async ( ) => {
3821+ const { container } = render (
3822+ < AntMedia isTest = { true } >
3823+ < MockChild />
3824+ </ AntMedia >
3825+ ) ;
3826+
3827+ await waitFor ( ( ) => {
3828+ expect ( webRTCAdaptorConstructor ) . not . toBe ( undefined ) ;
3829+ } ) ;
3830+
3831+ currentConference . isMyMicMuted = false ;
3832+ await act ( async ( ) => {
3833+ currentConference . setPublishStreamId ( 'test-stream-id' ) ;
3834+ } ) ;
3835+
3836+ // Call the function
3837+ await act ( async ( ) => {
3838+ currentConference . checkAndTurnOffLocalCamera ( ) ;
3839+ } ) ;
3840+
3841+ // Assertion: only check the observable side effect
3842+ expect ( webRTCAdaptorConstructor . turnOffLocalCamera ) . toHaveBeenCalledWith ( 'test-stream-id' ) ;
3843+ } ) ;
3844+ } ) ;
38183845} ) ;
38193846
38203847
Original file line number Diff line number Diff line change @@ -2946,11 +2946,7 @@ function AntMedia(props) {
29462946 }
29472947
29482948 function checkAndTurnOffLocalCamera ( streamId ) {
2949- if ( isVideoEffectRunning ) {
2950- webRTCAdaptor ?. turnOffEffectCamera ( ) ;
2951- } else {
29522949 webRTCAdaptor ?. turnOffLocalCamera ( publishStreamId ) ;
2953- }
29542950
29552951 updateUserStatusMetadata ( isMyMicMuted , false ) ;
29562952 setIsMyCamTurnedOff ( true ) ;
You can’t perform that action at this time.
0 commit comments