@@ -1122,27 +1122,37 @@ describe('setupTransceivers', () => {
11221122 expect ( getTransceiversSpy ) . not . toHaveBeenCalled ( ) ;
11231123 } ) ;
11241124
1125- it ( 'should do nothing if video and audio transceivers already exist' , ( ) => {
1125+ it ( 'should only add screen share transceiver if video and audio transceivers already exist' , ( ) => {
11261126 getTransceiversSpy . mockReturnValue ( [ videoTransceiver , audioTransceiver ] ) ;
11271127 handler . setupTransceivers ( session ) ;
11281128
1129- expect ( addTransceiverSpy ) . not . toHaveBeenCalled ( ) ;
1129+ expect ( addTransceiverSpy ) . toHaveBeenCalledTimes ( 1 ) ;
1130+ expect ( addTransceiverSpy ) . toHaveBeenCalledWith ( 'video' , { direction : 'sendonly' } ) ;
11301131 } ) ;
11311132
1132- it ( 'should add video transceiver' , ( ) => {
1133+ it ( 'should add video transceiver and screen share transceiver ' , ( ) => {
11331134 getTransceiversSpy . mockReturnValue ( [ audioTransceiver ] ) ;
11341135 handler . setupTransceivers ( session ) ;
11351136
11361137 expect ( addTransceiverSpy ) . toHaveBeenCalledWith ( 'video' , { direction : 'sendrecv' } ) ;
1137- expect ( addTransceiverSpy ) . toHaveReturnedTimes ( 1 ) ;
1138+ expect ( addTransceiverSpy ) . toHaveBeenCalledWith ( 'video' , { direction : 'sendonly' } ) ;
1139+ expect ( addTransceiverSpy ) . toHaveBeenCalledTimes ( 2 ) ;
11381140 } ) ;
11391141
1140- it ( 'should add audio transceiver' , ( ) => {
1142+ it ( 'should add audio transceiver and screen share transceiver ' , ( ) => {
11411143 getTransceiversSpy . mockReturnValue ( [ videoTransceiver ] ) ;
11421144 handler . setupTransceivers ( session ) ;
11431145
11441146 expect ( addTransceiverSpy ) . toHaveBeenCalledWith ( 'audio' , { direction : 'sendrecv' } ) ;
1145- expect ( addTransceiverSpy ) . toHaveReturnedTimes ( 1 ) ;
1147+ expect ( addTransceiverSpy ) . toHaveBeenCalledWith ( 'video' , { direction : 'sendonly' } ) ;
1148+ expect ( addTransceiverSpy ) . toHaveBeenCalledTimes ( 2 ) ;
1149+ } ) ;
1150+
1151+ it ( 'should add screen share transceiver for multi-track screen share support' , ( ) => {
1152+ getTransceiversSpy . mockReturnValue ( [ videoTransceiver , audioTransceiver ] ) ;
1153+ handler . setupTransceivers ( session ) ;
1154+
1155+ expect ( addTransceiverSpy ) . toHaveBeenCalledWith ( 'video' , { direction : 'sendonly' } ) ;
11461156 } ) ;
11471157} ) ;
11481158
0 commit comments