2022-10-26 10:48:34 +02:00
|
|
|
/*
|
2024-09-06 10:22:13 +02:00
|
|
|
Copyright 2022-2024 New Vector Ltd.
|
2022-10-26 10:48:34 +02:00
|
|
|
|
2024-09-06 10:22:13 +02:00
|
|
|
SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
|
Please see LICENSE in the repository root for full details.
|
2022-10-26 10:48:34 +02:00
|
|
|
*/
|
|
|
|
|
|
2024-12-11 09:27:55 +00:00
|
|
|
import { render, type RenderResult } from "@testing-library/react";
|
|
|
|
|
import { type MatrixClient } from "matrix-js-sdk/src/matrix";
|
2022-10-26 10:48:34 +02:00
|
|
|
import { MemoryRouter } from "react-router-dom";
|
2024-08-27 09:45:39 -04:00
|
|
|
import { describe, expect, it } from "vitest";
|
|
|
|
|
|
|
|
|
|
import { CallList } from "../../src/home/CallList";
|
2024-12-11 09:27:55 +00:00
|
|
|
import { type GroupCallRoom } from "../../src/home/useGroupCallRooms";
|
2022-10-26 10:48:34 +02:00
|
|
|
|
|
|
|
|
describe("CallList", () => {
|
|
|
|
|
const renderComponent = (rooms: GroupCallRoom[]): RenderResult => {
|
|
|
|
|
return render(
|
2024-08-27 09:45:39 -04:00
|
|
|
<MemoryRouter>
|
|
|
|
|
<CallList client={{} as MatrixClient} rooms={rooms} />
|
|
|
|
|
</MemoryRouter>,
|
2022-10-26 10:48:34 +02:00
|
|
|
);
|
|
|
|
|
};
|
|
|
|
|
|
2024-09-10 09:49:35 +02:00
|
|
|
it("should show room", () => {
|
2022-10-26 10:48:34 +02:00
|
|
|
const rooms = [
|
2023-08-09 14:08:23 +02:00
|
|
|
{
|
|
|
|
|
roomName: "Room #1",
|
|
|
|
|
roomAlias: "#room-name:server.org",
|
|
|
|
|
room: {
|
|
|
|
|
roomId: "!roomId",
|
|
|
|
|
},
|
|
|
|
|
},
|
2022-10-26 10:48:34 +02:00
|
|
|
] as GroupCallRoom[];
|
|
|
|
|
|
|
|
|
|
const result = renderComponent(rooms);
|
|
|
|
|
|
|
|
|
|
expect(result.queryByText("Room #1")).toBeTruthy();
|
|
|
|
|
});
|
|
|
|
|
});
|