Skip to content

Commit 70f898c

Browse files
committed
Improve coverage
Signed-off-by: Michael Telatynski <[email protected]>
1 parent 1bee3be commit 70f898c

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

test/unit-tests/stores/right-panel/RightPanelStore-test.ts

+22
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ import { ActiveRoomChangedPayload } from "../../../../src/dispatcher/payloads/Ac
1818
import RightPanelStore from "../../../../src/stores/right-panel/RightPanelStore";
1919
import { RightPanelPhases } from "../../../../src/stores/right-panel/RightPanelStorePhases";
2020
import SettingsStore from "../../../../src/settings/SettingsStore";
21+
import { pendingVerificationRequestForUser } from "../../../../src/verification.ts";
22+
23+
jest.mock("../../../../src/verification");
2124

2225
describe("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

Comments
 (0)