@@ -22,7 +22,12 @@ import { logger } from "matrix-js-sdk/src/logger";
22
22
import SecurityRoomSettingsTab from "../../../../../../src/components/views/settings/tabs/room/SecurityRoomSettingsTab" ;
23
23
import MatrixClientContext from "../../../../../../src/contexts/MatrixClientContext" ;
24
24
import SettingsStore from "../../../../../../src/settings/SettingsStore" ;
25
- import { flushPromises , getMockClientWithEventEmitter , mockClientMethodsUser } from "../../../../../test-utils" ;
25
+ import {
26
+ clearAllModals ,
27
+ flushPromises ,
28
+ getMockClientWithEventEmitter ,
29
+ mockClientMethodsUser ,
30
+ } from "../../../../../test-utils" ;
26
31
import { filterBoolean } from "../../../../../../src/utils/arrays" ;
27
32
28
33
describe ( "<SecurityRoomSettingsTab />" , ( ) => {
@@ -86,10 +91,12 @@ describe("<SecurityRoomSettingsTab />", () => {
86
91
room . currentState . setStateEvents ( events ) ;
87
92
} ;
88
93
89
- beforeEach ( ( ) => {
94
+ beforeEach ( async ( ) => {
90
95
client . sendStateEvent . mockReset ( ) . mockResolvedValue ( { event_id : "test" } ) ;
91
96
client . isRoomEncrypted . mockReturnValue ( false ) ;
92
97
jest . spyOn ( SettingsStore , "getValue" ) . mockRestore ( ) ;
98
+
99
+ await clearAllModals ( ) ;
93
100
} ) ;
94
101
95
102
describe ( "join rule" , ( ) => {
@@ -343,6 +350,7 @@ describe("<SecurityRoomSettingsTab />", () => {
343
350
344
351
const dialog = await screen . findByRole ( "dialog" ) ;
345
352
353
+ expect ( within ( dialog ) . getByText ( "Enable encryption?" ) ) . toBeInTheDocument ( ) ;
346
354
fireEvent . click ( within ( dialog ) . getByText ( "OK" ) ) ;
347
355
348
356
expect ( client . sendStateEvent ) . toHaveBeenCalledWith ( room . roomId , EventType . RoomEncryption , {
0 commit comments