* refactor: move room list search to shared components * refactor: add view model * refactor: use view and vm in room list search component * refactor: use room list id instead of class for landmark navigation * refactor: remove old room list search css * test: add screenshots test for room list search view * test: fix e2e test using class as selector...
37 lines
1.4 KiB
TypeScript
37 lines
1.4 KiB
TypeScript
/*
|
|
* Copyright 2025 New Vector Ltd.
|
|
*
|
|
* SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only OR LicenseRef-Element-Commercial
|
|
* Please see LICENSE files in the repository root for full details.
|
|
*/
|
|
|
|
import React from "react";
|
|
import { render } from "jest-matrix-react";
|
|
import { mocked } from "jest-mock";
|
|
|
|
import { RoomListSearch } from "../../../../../../src/components/views/rooms/RoomListPanel/RoomListSearch";
|
|
import { MetaSpace } from "../../../../../../src/stores/spaces";
|
|
import { shouldShowComponent } from "../../../../../../src/customisations/helpers/UIComponents";
|
|
import LegacyCallHandler from "../../../../../../src/LegacyCallHandler";
|
|
|
|
jest.mock("../../../../../../src/customisations/helpers/UIComponents", () => ({
|
|
shouldShowComponent: jest.fn(),
|
|
}));
|
|
|
|
describe("<RoomListSearch />", () => {
|
|
function renderComponent(activeSpace = MetaSpace.Home) {
|
|
return render(<RoomListSearch activeSpace={activeSpace} />);
|
|
}
|
|
|
|
beforeEach(() => {
|
|
// By default, we consider shouldShowComponent(UIComponent.ExploreRooms) should return true
|
|
mocked(shouldShowComponent).mockReturnValue(true);
|
|
jest.spyOn(LegacyCallHandler.instance, "getSupportsPstnProtocol").mockReturnValue(false);
|
|
});
|
|
|
|
it("renders", () => {
|
|
const { asFragment } = renderComponent(MetaSpace.VideoRooms);
|
|
expect(asFragment()).toMatchSnapshot();
|
|
});
|
|
});
|