@@ -29,6 +29,7 @@ import DMRoomMap from "../../src/utils/DMRoomMap";
2929import SpaceStore from "../../src/stores/spaces/SpaceStore" ;
3030import { MetaSpace } from "../../src/stores/spaces" ;
3131import { ActionPayload } from "../../src/dispatcher/payloads" ;
32+ import SettingsStore from "../../src/settings/SettingsStore" ;
3233
3334describe ( "leaveRoomBehaviour" , ( ) => {
3435 SdkContextClass . instance . constructEagerStores ( ) ; // Initialize RoomViewStore
@@ -128,4 +129,29 @@ describe("leaveRoomBehaviour", () => {
128129 metricsTrigger : undefined ,
129130 } ) ;
130131 } ) ;
132+
133+ describe ( "If the feature_dynamic_room_predecessors is not enabled" , ( ) => {
134+ beforeEach ( ( ) => {
135+ jest . spyOn ( SettingsStore , "getValue" ) . mockReturnValue ( false ) ;
136+ } ) ;
137+
138+ it ( "Passes through the dynamic predecessor setting" , async ( ) => {
139+ await leaveRoomBehaviour ( room . roomId ) ;
140+ expect ( client . getRoomUpgradeHistory ) . toHaveBeenCalledWith ( room . roomId , false , false ) ;
141+ } ) ;
142+ } ) ;
143+
144+ describe ( "If the feature_dynamic_room_predecessors is enabled" , ( ) => {
145+ beforeEach ( ( ) => {
146+ // Turn on feature_dynamic_room_predecessors setting
147+ jest . spyOn ( SettingsStore , "getValue" ) . mockImplementation (
148+ ( settingName ) => settingName === "feature_dynamic_room_predecessors" ,
149+ ) ;
150+ } ) ;
151+
152+ it ( "Passes through the dynamic predecessor setting" , async ( ) => {
153+ await leaveRoomBehaviour ( room . roomId ) ;
154+ expect ( client . getRoomUpgradeHistory ) . toHaveBeenCalledWith ( room . roomId , false , true ) ;
155+ } ) ;
156+ } ) ;
131157} ) ;
0 commit comments