Improve coverage

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
Michael Telatynski 2024-12-02 10:29:04 +00:00
parent 351774d3e3
commit 2099aaa663
No known key found for this signature in database
GPG key ID: A2B008A5F49F5D0D
3 changed files with 139 additions and 6 deletions

View file

@ -75,6 +75,7 @@ import { ViewRoomErrorPayload } from "../../../../src/dispatcher/payloads/ViewRo
import { SearchScope } from "../../../../src/Searching";
import { MEGOLM_ENCRYPTION_ALGORITHM } from "../../../../src/utils/crypto";
import MatrixClientContext from "../../../../src/contexts/MatrixClientContext";
import { ViewUserPayload } from "../../../../src/dispatcher/payloads/ViewUserPayload.ts";
describe("RoomView", () => {
let cli: MockedObject<MatrixClient>;
@ -202,6 +203,21 @@ describe("RoomView", () => {
return ref.current!;
};
it("should show member list right panel phase on Action.ViewUser without `payload.member`", async () => {
const spy = jest.spyOn(stores.rightPanelStore, "showOrHidePhase");
await renderRoomView(false);
defaultDispatcher.dispatch<ViewUserPayload>(
{
action: Action.ViewUser,
member: undefined,
},
true,
);
expect(spy).toHaveBeenCalledWith(RightPanelPhases.MemberList);
});
it("when there is no room predecessor, getHiddenHighlightCount should return 0", async () => {
const instance = await getRoomViewInstance();
expect(instance.getHiddenHighlightCount()).toBe(0);