File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed
Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -1110,6 +1110,20 @@ describe("ClientWidgetApi", () => {
11101110 await clientWidgetApi . feedToDevice ( event , encrypted ) ;
11111111 expect ( transport . send ) . toHaveBeenCalledWith ( WidgetApiToWidgetAction . SendToDevice , { ...event , encrypted } ) ;
11121112 } ) ;
1113+ it ( "ignores messages not allowed by capabilities" , async ( ) => {
1114+ const event : IToDeviceMessage = {
1115+ content : { foo : "bar" } ,
1116+ type : "org.example.othertype" ,
1117+ sender : "@alice:example.org" ,
1118+ } ;
1119+ // Give the widget capabilities to receive from just one room
1120+ await loadIframe ( [ "org.matrix.msc3819.receive.to_device:org.example.mytype" ] ) ;
1121+ // Clear all prior messages.
1122+ jest . mocked ( transport . send ) . mockClear ( ) ;
1123+ // Event from the matching room should be forwarded
1124+ await clientWidgetApi . feedToDevice ( event , false ) ;
1125+ expect ( transport . send ) . not . toHaveBeenCalled ( ) ;
1126+ } ) ;
11131127 } ) ;
11141128
11151129 describe ( "update_delayed_event action" , ( ) => {
You can’t perform that action at this time.
0 commit comments