@@ -620,9 +620,7 @@ describe("MatrixRTCSession", () => {
620620 it ( "sends a notification when starting a call and emit DidSendCallNotification" , async ( ) => {
621621 // Simulate a join, including the update to the room state
622622 // Ensure sendEvent returns event IDs so the DidSendCallNotification payload includes them
623- sendEventMock
624- . mockResolvedValueOnce ( { event_id : "legacy-evt" } )
625- . mockResolvedValueOnce ( { event_id : "new-evt" } ) ;
623+ sendEventMock . mockResolvedValueOnce ( { event_id : "new-evt" } ) ;
626624 const didSendEventFn = vi . fn ( ) ;
627625 sess ! . once ( MatrixRTCSessionEvent . DidSendCallNotification , didSendEventFn ) ;
628626 // Create an additional listener to create a promise that resolves after the emission.
@@ -647,43 +645,25 @@ describe("MatrixRTCSession", () => {
647645 "sender_ts" : expect . any ( Number ) ,
648646 } ) ;
649647
650- // Check if deprecated notify event is also sent.
651- expect ( client . sendEvent ) . toHaveBeenCalledWith ( mockRoom ! . roomId , EventType . CallNotify , {
652- "application" : "m.call" ,
653- "m.mentions" : { user_ids : [ ] , room : true } ,
654- "notify_type" : "ring" ,
655- "call_id" : "" ,
656- } ) ;
657648 await didSendNotification ;
658649 // And ensure we emitted the DidSendCallNotification event with both payloads
659- expect ( didSendEventFn ) . toHaveBeenCalledWith (
660- {
661- "event_id" : "new-evt" ,
662- "lifetime" : 30000 ,
663- "m.mentions" : { room : true , user_ids : [ ] } ,
664- "m.relates_to" : {
665- event_id : expect . any ( String ) ,
666- rel_type : "m.reference" ,
667- } ,
668- "notification_type" : "ring" ,
669- "sender_ts" : expect . any ( Number ) ,
670- } ,
671- {
672- "application" : "m.call" ,
673- "call_id" : "" ,
674- "event_id" : "legacy-evt" ,
675- "m.mentions" : { room : true , user_ids : [ ] } ,
676- "notify_type" : "ring" ,
650+ expect ( didSendEventFn ) . toHaveBeenCalledWith ( {
651+ "event_id" : "new-evt" ,
652+ "lifetime" : 30000 ,
653+ "m.mentions" : { room : true , user_ids : [ ] } ,
654+ "m.relates_to" : {
655+ event_id : expect . any ( String ) ,
656+ rel_type : "m.reference" ,
677657 } ,
678- ) ;
658+ "notification_type" : "ring" ,
659+ "sender_ts" : expect . any ( Number ) ,
660+ } ) ;
679661 } ) ;
680662
681663 it ( "sends a notification with a intent when starting a call and emits DidSendCallNotification" , async ( ) => {
682664 // Simulate a join, including the update to the room state
683665 // Ensure sendEvent returns event IDs so the DidSendCallNotification payload includes them
684- sendEventMock
685- . mockResolvedValueOnce ( { event_id : "legacy-evt" } )
686- . mockResolvedValueOnce ( { event_id : "new-evt" } ) ;
666+ sendEventMock . mockResolvedValueOnce ( { event_id : "new-evt" } ) ;
687667 const didSendEventFn = vi . fn ( ) ;
688668 sess ! . once ( MatrixRTCSessionEvent . DidSendCallNotification , didSendEventFn ) ;
689669 // Create an additional listener to create a promise that resolves after the emission.
@@ -707,51 +687,35 @@ describe("MatrixRTCSession", () => {
707687 ] ) ;
708688
709689 await sess ! . _onRTCSessionMemberUpdate ( ) ;
710- const ownMembershipId = sess ?. memberships [ 0 ] . eventId ;
690+ const ownMembershipEventId = sess ?. memberships [ 0 ] . eventId ;
711691 expect ( sess ! . getConsensusCallIntent ( ) ) . toEqual ( "audio" ) ;
712692
713693 expect ( client . sendEvent ) . toHaveBeenCalledWith ( mockRoom ! . roomId , EventType . RTCNotification , {
714694 "m.mentions" : { user_ids : [ ] , room : true } ,
715695 "notification_type" : "ring" ,
716696 "m.call.intent" : "audio" ,
717697 "m.relates_to" : {
718- event_id : ownMembershipId ,
698+ event_id : ownMembershipEventId ,
719699 rel_type : "m.reference" ,
720700 } ,
721701 "lifetime" : 30000 ,
722702 "sender_ts" : expect . any ( Number ) ,
723703 } ) ;
724704
725- // Check if deprecated notify event is also sent.
726- expect ( client . sendEvent ) . toHaveBeenCalledWith ( mockRoom ! . roomId , EventType . CallNotify , {
727- "application" : "m.call" ,
728- "m.mentions" : { user_ids : [ ] , room : true } ,
729- "notify_type" : "ring" ,
730- "call_id" : "" ,
731- } ) ;
732705 await didSendNotification ;
733706 // And ensure we emitted the DidSendCallNotification event with both payloads
734- expect ( didSendEventFn ) . toHaveBeenCalledWith (
735- {
736- "event_id" : "new-evt" ,
737- "lifetime" : 30000 ,
738- "m.mentions" : { room : true , user_ids : [ ] } ,
739- "m.relates_to" : {
740- event_id : expect . any ( String ) ,
741- rel_type : "m.reference" ,
742- } ,
743- "notification_type" : "ring" ,
744- "m.call.intent" : "audio" ,
745- "sender_ts" : expect . any ( Number ) ,
746- } ,
747- {
748- "application" : "m.call" ,
749- "call_id" : "" ,
750- "event_id" : "legacy-evt" ,
751- "m.mentions" : { room : true , user_ids : [ ] } ,
752- "notify_type" : "ring" ,
707+ expect ( didSendEventFn ) . toHaveBeenCalledWith ( {
708+ "event_id" : "new-evt" ,
709+ "lifetime" : 30000 ,
710+ "m.mentions" : { room : true , user_ids : [ ] } ,
711+ "m.relates_to" : {
712+ event_id : expect . any ( String ) ,
713+ rel_type : "m.reference" ,
753714 } ,
754- ) ;
715+ "notification_type" : "ring" ,
716+ "m.call.intent" : "audio" ,
717+ "sender_ts" : expect . any ( Number ) ,
718+ } ) ;
755719 } ) ;
756720
757721 it ( "doesn't send a notification when joining an existing call" , async ( ) => {
0 commit comments