@@ -105,7 +105,7 @@ type MockMediaSignalingSession = {
105105 processSignal : jest . Mock ;
106106 setIceGatheringTimeout : jest . Mock ;
107107 startCall : jest . Mock ;
108- getMainCall : jest . Mock ;
108+ getCallData : jest . Mock ;
109109} ;
110110
111111const createdSessions : MockMediaSignalingSession [ ] = [ ] ;
@@ -124,7 +124,7 @@ jest.mock('@rocket.chat/media-signaling', () => ({
124124 this . processSignal = jest . fn ( ) . mockResolvedValue ( undefined ) ;
125125 this . setIceGatheringTimeout = jest . fn ( ) ;
126126 this . startCall = jest . fn ( ) . mockResolvedValue ( undefined ) ;
127- this . getMainCall = jest . fn ( ) ;
127+ this . getCallData = jest . fn ( ) ;
128128 Object . defineProperty ( this , 'sessionId' , { value : `session-${ config . userId } ` , writable : false } ) ;
129129 createdSessions . push ( this ) ;
130130 } )
@@ -160,13 +160,23 @@ function buildClientMediaCall(options: {
160160 role : 'caller' | 'callee' ;
161161 hidden ?: boolean ;
162162 reject ?: jest . Mock ;
163+ contact ?: { username ?: string ; sipExtension ?: string } ;
163164} ) : IClientMediaCall {
164165 const reject = options . reject ?? jest . fn ( ) ;
165166 const emitter = { on : jest . fn ( ) , off : jest . fn ( ) , emit : jest . fn ( ) } ;
166167 return {
167168 callId : options . callId ,
168- role : options . role ,
169169 hidden : options . hidden ?? false ,
170+ localParticipant : { local : true , role : options . role , muted : false , held : false , contact : { } } ,
171+ remoteParticipants : [
172+ {
173+ local : false ,
174+ role : options . role === 'caller' ? 'callee' : 'caller' ,
175+ muted : false ,
176+ held : false ,
177+ contact : options . contact ?? { }
178+ }
179+ ] ,
170180 reject,
171181 emitter : emitter as unknown as IClientMediaCall [ 'emitter' ]
172182 } as unknown as IClientMediaCall ;
@@ -505,9 +515,9 @@ describe('MediaSessionInstance', () => {
505515 newCallHandler ( {
506516 call : {
507517 hidden : false ,
508- role : 'caller' ,
518+ localParticipant : { role : 'caller' } ,
519+ remoteParticipants : [ { contact : { username : 'alice' , sipExtension : '' } } ] ,
509520 callId : 'c1' ,
510- contact : { username : 'alice' , sipExtension : '' } ,
511521 emitter : { on : jest . fn ( ) , off : jest . fn ( ) }
512522 } as unknown as IClientMediaCall
513523 } ) ;
@@ -536,9 +546,9 @@ describe('MediaSessionInstance', () => {
536546 newCallHandler ( {
537547 call : {
538548 hidden : false ,
539- role : 'caller' ,
549+ localParticipant : { role : 'caller' } ,
550+ remoteParticipants : [ { contact : { username : 'alice' , sipExtension : '' } } ] ,
540551 callId : 'c1' ,
541- contact : { username : 'alice' , sipExtension : '' } ,
542552 emitter : { on : jest . fn ( ) , off : jest . fn ( ) }
543553 } as unknown as IClientMediaCall
544554 } ) ;
@@ -557,9 +567,9 @@ describe('MediaSessionInstance', () => {
557567 newCallHandler ( {
558568 call : {
559569 hidden : false ,
560- role : 'caller' ,
570+ localParticipant : { role : 'caller' } ,
571+ remoteParticipants : [ { contact : { username : 'alice' , sipExtension : '100' } } ] ,
561572 callId : 'c1' ,
562- contact : { username : 'alice' , sipExtension : '100' } ,
563573 emitter : { on : jest . fn ( ) , off : jest . fn ( ) }
564574 } as unknown as IClientMediaCall
565575 } ) ;
@@ -575,9 +585,9 @@ describe('MediaSessionInstance', () => {
575585 const mainCall = {
576586 callId : 'call-ans' ,
577587 accept : jest . fn ( ) . mockResolvedValue ( undefined ) ,
578- contact : { username : 'bob' , sipExtension : '' }
588+ remoteParticipants : [ { contact : { username : 'bob' , sipExtension : '' } } ]
579589 } ;
580- session . getMainCall . mockReturnValue ( mainCall ) ;
590+ session . getCallData . mockReturnValue ( mainCall ) ;
581591
582592 await mediaSessionInstance . answerCall ( 'call-ans' ) ;
583593
@@ -591,9 +601,9 @@ describe('MediaSessionInstance', () => {
591601 const mainCall = {
592602 callId : 'call-sip' ,
593603 accept : jest . fn ( ) . mockResolvedValue ( undefined ) ,
594- contact : { username : 'bob' , sipExtension : 'ext' }
604+ remoteParticipants : [ { contact : { username : 'bob' , sipExtension : 'ext' } } ]
595605 } ;
596- session . getMainCall . mockReturnValue ( mainCall ) ;
606+ session . getCallData . mockReturnValue ( mainCall ) ;
597607
598608 await mediaSessionInstance . answerCall ( 'call-sip' ) ;
599609
0 commit comments