import { CallAgent , CallAgentOptions , DeviceManager } from '@azure/communication-calling' ; import { CommunicationTokenCredential } from '@azure/communication-common' ; import { ReactElement } from 'react' ; import { CallingHandlers , createDefaultCallingHandlersForComponent } from './createHandlers' ; import { StatefulCallClient } from '@internal/calling-stateful-client' ; function TestCallClientComponent ( props ) { return null ; } class MockCallClient { getState ( ) { throw new Error ( 'Method not implemented.' ) ; } onStateChange ( handler ) { throw new Error ( 'Method not implemented.' ) ; } createView ( callId , participantId , stream , options ? ) { throw new Error ( 'Method not implemented.' ) ; } disposeView ( callId , participantId , stream ) { throw new Error ( 'Method not implemented.' ) ; } createCallAgent ( tokenCredential , options ? ) { throw new Error ( 'Method not implemented.' ) ; } getDeviceManager ( ) { throw new Error ( 'Method not implemented.' ) ; } } describe ( 'createHandlers' , ( ) => { test ( 'creates handlers when only callClient is passed in and others are undefined' , async ( ) => { const handlers = createDefaultCallingHandlersForComponent ( new MockCallClient ( ) as StatefulCallClient , undefined , undefined , undefined , TestCallClientComponent ) ; expect ( handlers ) . toBeDefined ( ) ; expect ( Object . keys ( handlers ) . length > 0 ) . toBe ( true ) ; } ) ; } ) ;