@@ -29,6 +29,7 @@ import DMRoomMap from "../../src/utils/DMRoomMap";
29
29
import SpaceStore from "../../src/stores/spaces/SpaceStore" ;
30
30
import { MetaSpace } from "../../src/stores/spaces" ;
31
31
import { ActionPayload } from "../../src/dispatcher/payloads" ;
32
+ import SettingsStore from "../../src/settings/SettingsStore" ;
32
33
33
34
describe ( "leaveRoomBehaviour" , ( ) => {
34
35
SdkContextClass . instance . constructEagerStores ( ) ; // Initialize RoomViewStore
@@ -128,4 +129,29 @@ describe("leaveRoomBehaviour", () => {
128
129
metricsTrigger : undefined ,
129
130
} ) ;
130
131
} ) ;
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
+ } ) ;
131
157
} ) ;
0 commit comments