@@ -18,6 +18,9 @@ import { ActiveRoomChangedPayload } from "../../../../src/dispatcher/payloads/Ac
18
18
import RightPanelStore from "../../../../src/stores/right-panel/RightPanelStore" ;
19
19
import { RightPanelPhases } from "../../../../src/stores/right-panel/RightPanelStorePhases" ;
20
20
import SettingsStore from "../../../../src/settings/SettingsStore" ;
21
+ import { pendingVerificationRequestForUser } from "../../../../src/verification.ts" ;
22
+
23
+ jest . mock ( "../../../../src/verification" ) ;
21
24
22
25
describe ( "RightPanelStore" , ( ) => {
23
26
// Mock out the settings store so the right panel store can't persist values between tests
@@ -217,4 +220,23 @@ describe("RightPanelStore", () => {
217
220
await viewRoom ( "!1:example.org" ) ;
218
221
expect ( store . currentCardForRoom ( "!1:example.org" ) . phase ) . toEqual ( RightPanelPhases . MemberList ) ;
219
222
} ) ;
223
+
224
+ it ( "should redirect to verification if set to phase MemberInfo for a user with a pending verification" , async ( ) => {
225
+ const member = new RoomMember ( "!1:example.org" , "@alice:example.org" ) ;
226
+ const verificationRequest = { mockVerificationRequest : true } as any ;
227
+ mocked ( pendingVerificationRequestForUser ) . mockReturnValue ( verificationRequest ) ;
228
+ await viewRoom ( "!1:example.org" ) ;
229
+ store . setCard (
230
+ {
231
+ phase : RightPanelPhases . MemberInfo ,
232
+ state : { member } ,
233
+ } ,
234
+ true ,
235
+ "!1:example.org" ,
236
+ ) ;
237
+ expect ( store . currentCard ) . toEqual ( {
238
+ phase : RightPanelPhases . EncryptionPanel ,
239
+ state : { member, verificationRequest } ,
240
+ } ) ;
241
+ } ) ;
220
242
} ) ;
0 commit comments