@@ -1197,12 +1197,13 @@ describe('handleSoftphoneConversationUpdate()', () => {
11971197 ) ;
11981198 } ) ;
11991199
1200- it ( 'should emit a pending session if we already have an active session' , async ( ) => {
1200+ it ( 'should emit a pending session if we already have an active session with a different conversationId ' , async ( ) => {
12011201 const { update, participant, callState, session } = generateUpdate ( {
12021202 callState : CommunicationStates . alerting
12031203 } ) ;
12041204
12051205 handler . activeSession = session ;
1206+ update . id = session . conversationId + '1' ;
12061207
12071208 handler . handleSoftphoneConversationUpdate ( update , participant , callState , session ) ;
12081209
@@ -1228,6 +1229,21 @@ describe('handleSoftphoneConversationUpdate()', () => {
12281229 expect ( mockSessionManager . pendingSessions [ 0 ] ) . toEqual ( expectedPendingSession ) ;
12291230 } ) ;
12301231
1232+ it ( 'should not emit a pending session if the active session is for the same conversation' , async ( ) => {
1233+ const { update, participant, callState, session } = generateUpdate ( {
1234+ callState : CommunicationStates . alerting
1235+ } ) ;
1236+ handler . activeSession = session ;
1237+
1238+ handler . handleSoftphoneConversationUpdate ( update , participant , callState , session ) ;
1239+
1240+ await flushPromises ( ) ;
1241+
1242+ expect ( emitConversationEventSpy ) . not . toHaveBeenCalled ( ) ;
1243+ expect ( sdkEmitSpy ) . not . toHaveBeenCalled ( ) ;
1244+ expect ( mockSessionManager . pendingSessions . length ) . toBe ( 0 ) ;
1245+ } ) ;
1246+
12311247 it ( 'should not emit a pending session if we do not have an active session' , ( ) => {
12321248 const { update, participant, callState, session } = generateUpdate ( {
12331249 callState : CommunicationStates . alerting
0 commit comments