Skip to content
This repository was archived by the owner on Oct 22, 2024. It is now read-only.

Commit 80830c8

Browse files
committed
Add a test in EventTile-test.tsx
1 parent 2f34023 commit 80830c8

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

test/components/views/rooms/EventTile-test.tsx

+20
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ import DMRoomMap from "../../../../src/utils/DMRoomMap";
3232
import dis from "../../../../src/dispatcher/dispatcher";
3333
import { Action } from "../../../../src/dispatcher/actions";
3434
import { IRoomState } from "../../../../src/components/structures/RoomView";
35+
import PinningUtils from "../../../../src/utils/PinningUtils.ts";
3536

3637
describe("EventTile", () => {
3738
const ROOM_ID = "!roomId:example.org";
@@ -91,6 +92,10 @@ describe("EventTile", () => {
9192
});
9293
});
9394

95+
afterEach(() => {
96+
jest.spyOn(PinningUtils, "isPinned").mockReturnValue(false);
97+
});
98+
9499
describe("EventTile thread summary", () => {
95100
beforeEach(() => {
96101
jest.spyOn(client, "supportsThreads").mockReturnValue(true);
@@ -154,6 +159,15 @@ describe("EventTile", () => {
154159
});
155160
});
156161

162+
describe("EventTile renderingType: Threads", () => {
163+
it("should display the pinned message badge", async () => {
164+
jest.spyOn(PinningUtils, "isPinned").mockReturnValue(true);
165+
getComponent({}, TimelineRenderingType.Thread);
166+
167+
expect(screen.getByText("Pinned message")).toBeInTheDocument();
168+
});
169+
});
170+
157171
describe("EventTile in the right panel", () => {
158172
beforeAll(() => {
159173
const dmRoomMap: DMRoomMap = {
@@ -510,4 +524,10 @@ describe("EventTile", () => {
510524
});
511525
});
512526
});
527+
528+
test("it should render a pinned message badge", async () => {
529+
jest.spyOn(PinningUtils, "isPinned").mockReturnValue(true);
530+
getComponent();
531+
expect(screen.getByText("Pinned message")).toBeInTheDocument();
532+
});
513533
});

0 commit comments

Comments
 (0)