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

Commit 9086e93

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

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

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

+27
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ 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";
36+
import { Layout } from "../../../../src/settings/enums/Layout";
3537

3638
describe("EventTile", () => {
3739
const ROOM_ID = "!roomId:example.org";
@@ -91,6 +93,10 @@ describe("EventTile", () => {
9193
});
9294
});
9395

96+
afterEach(() => {
97+
jest.spyOn(PinningUtils, "isPinned").mockReturnValue(false);
98+
});
99+
94100
describe("EventTile thread summary", () => {
95101
beforeEach(() => {
96102
jest.spyOn(client, "supportsThreads").mockReturnValue(true);
@@ -154,6 +160,27 @@ describe("EventTile", () => {
154160
});
155161
});
156162

163+
describe("EventTile renderingType: Threads", () => {
164+
it("should display the pinned message badge", async () => {
165+
jest.spyOn(PinningUtils, "isPinned").mockReturnValue(true);
166+
getComponent({}, TimelineRenderingType.Thread);
167+
168+
expect(screen.getByText("Pinned message")).toBeInTheDocument();
169+
});
170+
});
171+
172+
describe("EventTile renderingType: default", () => {
173+
it.each([[Layout.Group], [Layout.Bubble], [Layout.IRC]])(
174+
"should display the pinned message badge",
175+
async (layout) => {
176+
jest.spyOn(PinningUtils, "isPinned").mockReturnValue(true);
177+
getComponent({ layout });
178+
179+
expect(screen.getByText("Pinned message")).toBeInTheDocument();
180+
},
181+
);
182+
});
183+
157184
describe("EventTile in the right panel", () => {
158185
beforeAll(() => {
159186
const dmRoomMap: DMRoomMap = {

0 commit comments

Comments
 (0)