File tree Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -912,6 +912,37 @@ describe('ClientWidgetApi', () => {
912912 } ) ;
913913 } ) ;
914914
915+ describe ( 'dont receive UpdateState if version not supported' , ( ) => {
916+ it ( 'syncs initial state and feeds updates' , async ( ) => {
917+ const roomId = '!room:example.org' ;
918+ clientWidgetApi . setViewedRoomId ( roomId ) ;
919+ jest . spyOn ( transport , "send" ) . mockImplementation ( ( action , data ) => {
920+ if ( action === WidgetApiToWidgetAction . SupportedApiVersions ) {
921+ return Promise . resolve ( { supported_versions : [ ] } ) ;
922+ }
923+ return Promise . resolve ( { } ) ;
924+ } ) ;
925+
926+ await loadIframe ( [
927+ 'org.matrix.msc2762.receive.state_event:m.room.join_rules#' ,
928+ ] ) ;
929+
930+ const newJoinRulesEvent = createRoomEvent ( {
931+ room_id : roomId ,
932+ type : 'm.room.join_rules' ,
933+ state_key : '' ,
934+ content : { join_rule : 'invite' } ,
935+ } ) ;
936+ clientWidgetApi . feedStateUpdate ( newJoinRulesEvent ) ;
937+
938+ await waitFor ( ( ) => {
939+
940+ // Only the updated join rules should have been delivered
941+ expect ( transport . send ) . not . toHaveBeenCalledWith ( WidgetApiToWidgetAction . UpdateState ) ;
942+ } ) ;
943+ } ) ;
944+ } ) ;
945+
915946 describe ( 'update_delayed_event action' , ( ) => {
916947 it ( 'fails to update delayed events' , async ( ) => {
917948 const event : IUpdateDelayedEventFromWidgetActionRequest = {
You can’t perform that action at this time.
0 commit comments