mirror of
https://github.com/vector-im/element-call.git
synced 2026-08-29 21:15:19 +00:00
Fix tests
This commit is contained in:
@@ -12,7 +12,7 @@ import { FC, PropsWithChildren } from "react";
|
|||||||
|
|
||||||
import { ClientContextProvider } from "./ClientContext";
|
import { ClientContextProvider } from "./ClientContext";
|
||||||
import { Avatar } from "./Avatar";
|
import { Avatar } from "./Avatar";
|
||||||
import { mockMatrixRoomMember } from "./utils/test";
|
import { mockMatrixRoomMember, mockRtcMembership } from "./utils/test";
|
||||||
|
|
||||||
const TestComponent: FC<
|
const TestComponent: FC<
|
||||||
PropsWithChildren<{ client: MatrixClient; supportsThumbnails?: boolean }>
|
PropsWithChildren<{ client: MatrixClient; supportsThumbnails?: boolean }>
|
||||||
@@ -51,10 +51,12 @@ test("should just render a placeholder when the user has no avatar", () => {
|
|||||||
} as unknown as MatrixClient);
|
} as unknown as MatrixClient);
|
||||||
|
|
||||||
vi.spyOn(client, "mxcUrlToHttp");
|
vi.spyOn(client, "mxcUrlToHttp");
|
||||||
const member = mockMatrixRoomMember({
|
const member = mockMatrixRoomMember(
|
||||||
userId: "@alice:example.org",
|
mockRtcMembership("@alice:example.org", "AAAA"),
|
||||||
getMxcAvatarUrl: () => undefined,
|
{
|
||||||
});
|
getMxcAvatarUrl: () => undefined,
|
||||||
|
},
|
||||||
|
);
|
||||||
const displayName = "Alice";
|
const displayName = "Alice";
|
||||||
render(
|
render(
|
||||||
<TestComponent client={client}>
|
<TestComponent client={client}>
|
||||||
@@ -78,10 +80,12 @@ test("should just render a placeholder when thumbnails are not supported", () =>
|
|||||||
} as unknown as MatrixClient);
|
} as unknown as MatrixClient);
|
||||||
|
|
||||||
vi.spyOn(client, "mxcUrlToHttp");
|
vi.spyOn(client, "mxcUrlToHttp");
|
||||||
const member = mockMatrixRoomMember({
|
const member = mockMatrixRoomMember(
|
||||||
userId: "@alice:example.org",
|
mockRtcMembership("@alice:example.org", "AAAA"),
|
||||||
getMxcAvatarUrl: () => "mxc://example.org/alice-avatar",
|
{
|
||||||
});
|
getMxcAvatarUrl: () => "mxc://example.org/alice-avatar",
|
||||||
|
},
|
||||||
|
);
|
||||||
const displayName = "Alice";
|
const displayName = "Alice";
|
||||||
render(
|
render(
|
||||||
<TestComponent client={client} supportsThumbnails={false}>
|
<TestComponent client={client} supportsThumbnails={false}>
|
||||||
@@ -122,10 +126,12 @@ test("should attempt to fetch authenticated media", async () => {
|
|||||||
} as unknown as MatrixClient);
|
} as unknown as MatrixClient);
|
||||||
|
|
||||||
vi.spyOn(client, "mxcUrlToHttp").mockReturnValue(expectedAuthUrl);
|
vi.spyOn(client, "mxcUrlToHttp").mockReturnValue(expectedAuthUrl);
|
||||||
const member = mockMatrixRoomMember({
|
const member = mockMatrixRoomMember(
|
||||||
userId: "@alice:example.org",
|
mockRtcMembership("@alice:example.org", "AAAA"),
|
||||||
getMxcAvatarUrl: () => "mxc://example.org/alice-avatar",
|
{
|
||||||
});
|
getMxcAvatarUrl: () => "mxc://example.org/alice-avatar",
|
||||||
|
},
|
||||||
|
);
|
||||||
const displayName = "Alice";
|
const displayName = "Alice";
|
||||||
render(
|
render(
|
||||||
<TestComponent client={client}>
|
<TestComponent client={client}>
|
||||||
|
|||||||
Reference in New Issue
Block a user