@@ -18,6 +18,9 @@ import { ActiveRoomChangedPayload } from "../../../../src/dispatcher/payloads/Ac
1818import RightPanelStore from "../../../../src/stores/right-panel/RightPanelStore" ;
1919import { RightPanelPhases } from "../../../../src/stores/right-panel/RightPanelStorePhases" ;
2020import SettingsStore from "../../../../src/settings/SettingsStore" ;
21+ import { pendingVerificationRequestForUser } from "../../../../src/verification.ts" ;
22+
23+ jest . mock ( "../../../../src/verification" ) ;
2124
2225describe ( "RightPanelStore" , ( ) => {
2326 // Mock out the settings store so the right panel store can't persist values between tests
@@ -217,4 +220,23 @@ describe("RightPanelStore", () => {
217220 await viewRoom ( "!1:example.org" ) ;
218221 expect ( store . currentCardForRoom ( "!1:example.org" ) . phase ) . toEqual ( RightPanelPhases . MemberList ) ;
219222 } ) ;
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+ } ) ;
220242} ) ;
0 commit comments