@@ -98,6 +98,26 @@ describe("Group Call Event Handler", function () {
9898
9999 expect ( groupCall . state ) . toBe ( GroupCallState . Ended ) ;
100100 } ) ;
101+
102+ it ( 'terminates call when redacted' , async ( ) => {
103+ await groupCallEventHandler . start ( )
104+ mockClient . emitRoomState ( makeMockGroupCallStateEvent ( FAKE_ROOM_ID , FAKE_GROUP_CALL_ID ) , {
105+ roomId : FAKE_ROOM_ID ,
106+ } as unknown as RoomState ) ;
107+
108+ const groupCall = groupCallEventHandler . groupCalls . get ( FAKE_ROOM_ID ) ! ;
109+
110+ expect ( groupCall . state ) . toBe ( GroupCallState . LocalCallFeedUninitialized ) ;
111+
112+ mockClient . emitRoomState (
113+ makeMockGroupCallStateEvent ( FAKE_ROOM_ID , FAKE_GROUP_CALL_ID , undefined , true ) ,
114+ {
115+ roomId : FAKE_ROOM_ID ,
116+ } as unknown as RoomState ,
117+ ) ;
118+
119+ expect ( groupCall . state ) . toBe ( GroupCallState . Ended ) ;
120+ } )
101121 } ) ;
102122
103123 it ( "waits until client starts syncing" , async ( ) => {
@@ -222,9 +242,9 @@ describe("Group Call Event Handler", function () {
222242 jest . clearAllMocks ( ) ;
223243 } ) ;
224244
225- const setupCallAndStart = async ( content ?: IContent ) => {
245+ const setupCallAndStart = async ( content ?: IContent , redacted ?: boolean ) => {
226246 mocked ( mockRoom . currentState . getStateEvents ) . mockReturnValue ( [
227- makeMockGroupCallStateEvent ( FAKE_ROOM_ID , FAKE_GROUP_CALL_ID , content ) ,
247+ makeMockGroupCallStateEvent ( FAKE_ROOM_ID , FAKE_GROUP_CALL_ID , content , redacted ) ,
228248 ] as unknown as MatrixEvent ) ;
229249 mockClient . getRooms . mockReturnValue ( [ mockRoom ] ) ;
230250 await groupCallEventHandler . start ( ) ;
@@ -285,5 +305,21 @@ describe("Group Call Event Handler", function () {
285305 } ) ,
286306 ) ;
287307 } ) ;
308+
309+ it ( "ignores redacted calls" , async ( ) => {
310+ await setupCallAndStart ( {
311+ // Real event contents to make sure that it's specifically the
312+ // event being redacted that causes it to be ignored
313+ "m.type" : GroupCallType . Video ,
314+ "m.intent" : GroupCallIntent . Prompt ,
315+ } , true ) ;
316+
317+ expect ( mockClientEmit ) . not . toHaveBeenCalledWith (
318+ GroupCallEventHandlerEvent . Incoming ,
319+ expect . objectContaining ( {
320+ groupCallId : FAKE_GROUP_CALL_ID ,
321+ } ) ,
322+ ) ;
323+ } )
288324 } ) ;
289325} ) ;
0 commit comments