Docker / Docker Buildx (push) Has been cancelled
Build Debian package / Build package (release) Has been cancelled
Build and Deploy / prepare (release) Has been cancelled
Deploy release / Deploy to Cloudflare Pages (release) Has been cancelled
Build and Deploy / Trigger Pro pipeline (release) Has been cancelled
Build and Deploy / Windows arm64 (release) Has been cancelled
Build and Deploy / Windows x64 (release) Has been cancelled
Build and Deploy / macOS (release) Has been cancelled
Build and Deploy / Linux amd64 (sqlcipher static) (release) Has been cancelled
Build and Deploy / Linux arm64 (sqlcipher static) (release) Has been cancelled
Build and Deploy / ${{ needs.prepare.outputs.deploy == 'true' && 'Deploy' || 'Deploy (dry-run)' }} (release) Has been cancelled
Build and Deploy / Deploy builds to ESS (release) Has been cancelled
64 lines
2.1 KiB
TypeScript
64 lines
2.1 KiB
TypeScript
/*
|
|
Copyright 2026 Element Creations 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 { EventType, MsgType } from "matrix-js-sdk/src/matrix";
|
|
|
|
import ReplyTile from "../../../../../src/components/views/rooms/ReplyTile";
|
|
import { renderReplyTile } from "../../../../../src/events/EventTileFactory";
|
|
import { VideoBodyFactory } from "../../../../../src/components/views/messages/MBodyFactory";
|
|
import { mkEvent, stubClient } from "../../../../test-utils";
|
|
|
|
jest.mock("../../../../../src/events/EventTileFactory", () => {
|
|
const actual = jest.requireActual("../../../../../src/events/EventTileFactory");
|
|
return {
|
|
...actual,
|
|
renderReplyTile: jest.fn(() => null),
|
|
};
|
|
});
|
|
jest.mock("../../../../../src/components/views/messages/SenderProfile", () => jest.fn(() => null));
|
|
jest.mock("../../../../../src/components/views/avatars/MemberAvatar", () => jest.fn(() => null));
|
|
|
|
describe("ReplyTile", () => {
|
|
beforeEach(() => {
|
|
stubClient();
|
|
jest.mocked(renderReplyTile).mockClear().mockReturnValue(null);
|
|
});
|
|
|
|
it("renders video replies with the video body", () => {
|
|
const mxEvent = mkEvent({
|
|
event: true,
|
|
type: EventType.RoomMessage,
|
|
user: "@alice:server",
|
|
room: "!room:server",
|
|
id: "$video",
|
|
content: {
|
|
body: "video.mp4",
|
|
msgtype: MsgType.Video,
|
|
url: "mxc://server/video",
|
|
info: {
|
|
mimetype: "video/mp4",
|
|
w: 640,
|
|
h: 360,
|
|
},
|
|
},
|
|
});
|
|
|
|
render(<ReplyTile mxEvent={mxEvent} />);
|
|
|
|
expect(renderReplyTile).toHaveBeenCalledWith(
|
|
expect.objectContaining({
|
|
overrideBodyTypes: expect.objectContaining({
|
|
[MsgType.Video]: VideoBodyFactory,
|
|
}),
|
|
}),
|
|
false,
|
|
);
|
|
});
|
|
});
|