@@ -98,6 +98,23 @@ 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 ( makeMockGroupCallStateEvent ( FAKE_ROOM_ID , FAKE_GROUP_CALL_ID , undefined , true ) , {
113+ roomId : FAKE_ROOM_ID ,
114+ } as unknown as RoomState ) ;
115+
116+ expect ( groupCall . state ) . toBe ( GroupCallState . Ended ) ;
117+ } ) ;
101118 } ) ;
102119
103120 it ( "waits until client starts syncing" , async ( ) => {
@@ -222,9 +239,9 @@ describe("Group Call Event Handler", function () {
222239 jest . clearAllMocks ( ) ;
223240 } ) ;
224241
225- const setupCallAndStart = async ( content ?: IContent ) => {
242+ const setupCallAndStart = async ( content ?: IContent , redacted ?: boolean ) => {
226243 mocked ( mockRoom . currentState . getStateEvents ) . mockReturnValue ( [
227- makeMockGroupCallStateEvent ( FAKE_ROOM_ID , FAKE_GROUP_CALL_ID , content ) ,
244+ makeMockGroupCallStateEvent ( FAKE_ROOM_ID , FAKE_GROUP_CALL_ID , content , redacted ) ,
228245 ] as unknown as MatrixEvent ) ;
229246 mockClient . getRooms . mockReturnValue ( [ mockRoom ] ) ;
230247 await groupCallEventHandler . start ( ) ;
@@ -285,5 +302,24 @@ describe("Group Call Event Handler", function () {
285302 } ) ,
286303 ) ;
287304 } ) ;
305+
306+ it ( "ignores redacted calls" , async ( ) => {
307+ await setupCallAndStart (
308+ {
309+ // Real event contents to make sure that it's specifically the
310+ // event being redacted that causes it to be ignored
311+ "m.type" : GroupCallType . Video ,
312+ "m.intent" : GroupCallIntent . Prompt ,
313+ } ,
314+ true ,
315+ ) ;
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