@@ -40,6 +40,7 @@ import { StopGapWidgetDriver } from "../../../src/stores/widgets/StopGapWidgetDr
4040import { stubClient } from "../../test-utils" ;
4141import { ModuleRunner } from "../../../src/modules/ModuleRunner" ;
4242import dis from "../../../src/dispatcher/dispatcher" ;
43+ import SettingsStore from "../../../src/settings/SettingsStore" ;
4344
4445describe ( "StopGapWidgetDriver" , ( ) => {
4546 let client : MockedObject < MatrixClient > ;
@@ -366,4 +367,31 @@ describe("StopGapWidgetDriver", () => {
366367 expect ( dis . dispatch ) . not . toHaveBeenCalled ( ) ;
367368 } ) ;
368369 } ) ;
370+
371+ describe ( "If the feature_dynamic_room_predecessors feature is not enabled" , ( ) => {
372+ beforeEach ( ( ) => {
373+ jest . spyOn ( SettingsStore , "getValue" ) . mockReturnValue ( false ) ;
374+ } ) ;
375+
376+ it ( "passes the flag through to getVisibleRooms" , ( ) => {
377+ const driver = mkDefaultDriver ( ) ;
378+ driver . readRoomEvents ( EventType . CallAnswer , "" , 0 , [ "*" ] ) ;
379+ expect ( client . getVisibleRooms ) . toHaveBeenCalledWith ( false ) ;
380+ } ) ;
381+ } ) ;
382+
383+ describe ( "If the feature_dynamic_room_predecessors is enabled" , ( ) => {
384+ beforeEach ( ( ) => {
385+ // Turn on feature_dynamic_room_predecessors setting
386+ jest . spyOn ( SettingsStore , "getValue" ) . mockImplementation (
387+ ( settingName ) => settingName === "feature_dynamic_room_predecessors" ,
388+ ) ;
389+ } ) ;
390+
391+ it ( "passes the flag through to getVisibleRooms" , ( ) => {
392+ const driver = mkDefaultDriver ( ) ;
393+ driver . readRoomEvents ( EventType . CallAnswer , "" , 0 , [ "*" ] ) ;
394+ expect ( client . getVisibleRooms ) . toHaveBeenCalledWith ( true ) ;
395+ } ) ;
396+ } ) ;
369397} ) ;
0 commit comments