Improve coverage

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
Michael Telatynski 2024-12-02 09:13:33 +00:00
parent 1bee3becfb
commit 70f898c71d
No known key found for this signature in database
GPG key ID: A2B008A5F49F5D0D

View file

@ -18,6 +18,9 @@ import { ActiveRoomChangedPayload } from "../../../../src/dispatcher/payloads/Ac
import RightPanelStore from "../../../../src/stores/right-panel/RightPanelStore"; import RightPanelStore from "../../../../src/stores/right-panel/RightPanelStore";
import { RightPanelPhases } from "../../../../src/stores/right-panel/RightPanelStorePhases"; import { RightPanelPhases } from "../../../../src/stores/right-panel/RightPanelStorePhases";
import SettingsStore from "../../../../src/settings/SettingsStore"; import SettingsStore from "../../../../src/settings/SettingsStore";
import { pendingVerificationRequestForUser } from "../../../../src/verification.ts";
jest.mock("../../../../src/verification");
describe("RightPanelStore", () => { describe("RightPanelStore", () => {
// Mock out the settings store so the right panel store can't persist values between tests // 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"); await viewRoom("!1:example.org");
expect(store.currentCardForRoom("!1:example.org").phase).toEqual(RightPanelPhases.MemberList); 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 },
});
});
}); });