From 70f898c71db687b4322e4a9f1110416c923569fd Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Mon, 2 Dec 2024 09:13:33 +0000 Subject: [PATCH] Improve coverage Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- .../right-panel/RightPanelStore-test.ts | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/test/unit-tests/stores/right-panel/RightPanelStore-test.ts b/test/unit-tests/stores/right-panel/RightPanelStore-test.ts index 7fb32bcd6e..27c4d730a9 100644 --- a/test/unit-tests/stores/right-panel/RightPanelStore-test.ts +++ b/test/unit-tests/stores/right-panel/RightPanelStore-test.ts @@ -18,6 +18,9 @@ import { ActiveRoomChangedPayload } from "../../../../src/dispatcher/payloads/Ac import RightPanelStore from "../../../../src/stores/right-panel/RightPanelStore"; import { RightPanelPhases } from "../../../../src/stores/right-panel/RightPanelStorePhases"; import SettingsStore from "../../../../src/settings/SettingsStore"; +import { pendingVerificationRequestForUser } from "../../../../src/verification.ts"; + +jest.mock("../../../../src/verification"); describe("RightPanelStore", () => { // Mock out the settings store so the right panel store can't persist values between tests @@ -217,4 +220,23 @@ describe("RightPanelStore", () => { await viewRoom("!1:example.org"); expect(store.currentCardForRoom("!1:example.org").phase).toEqual(RightPanelPhases.MemberList); }); + + it("should redirect to verification if set to phase MemberInfo for a user with a pending verification", async () => { + const member = new RoomMember("!1:example.org", "@alice:example.org"); + const verificationRequest = { mockVerificationRequest: true } as any; + mocked(pendingVerificationRequestForUser).mockReturnValue(verificationRequest); + await viewRoom("!1:example.org"); + store.setCard( + { + phase: RightPanelPhases.MemberInfo, + state: { member }, + }, + true, + "!1:example.org", + ); + expect(store.currentCard).toEqual({ + phase: RightPanelPhases.EncryptionPanel, + state: { member, verificationRequest }, + }); + }); });