Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Fix broken Timeline panel jest test #11827

Merged
merged 2 commits into from
Nov 3, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 12 additions & 11 deletions test/components/structures/TimelinePanel-test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,16 +89,16 @@ const getProps = (room: Room, events: MatrixEvent[]): TimelinePanel["props"] =>
const mockEvents = (room: Room, count = 2): MatrixEvent[] => {
const events: MatrixEvent[] = [];
for (let index = 0; index < count; index++) {
events.push(
new MatrixEvent({
room_id: room.roomId,
event_id: `${room.roomId}_event_${index}`,
type: EventType.RoomMessage,
sender: "userId",
content: createMessageEventContent("`Event${index}`"),
origin_server_ts: index,
}),
);
const event = new MatrixEvent({
room_id: room.roomId,
event_id: `${room.roomId}_event_${index}`,
type: EventType.RoomMessage,
sender: "userId",
content: createMessageEventContent("`Event${index}`"),
origin_server_ts: index,
});
event.localTimestamp = index;
events.push(event);
}

return events;
Expand Down Expand Up @@ -542,12 +542,14 @@ describe("TimelinePanel", () => {
event_id: `virtualCallEvent1`,
origin_server_ts: 0,
});
virtualCallInvite.localTimestamp = 2;
const virtualCallMetaEvent = new MatrixEvent({
type: "org.matrix.call.sdp_stream_metadata_changed",
room_id: virtualRoom.roomId,
event_id: `virtualCallEvent2`,
origin_server_ts: 0,
});
virtualCallMetaEvent.localTimestamp = 2;
const virtualEvents = [virtualCallInvite, ...mockEvents(virtualRoom), virtualCallMetaEvent];
const { timelineSet: overlayTimelineSet } = getProps(virtualRoom, virtualEvents);

Expand All @@ -558,7 +560,6 @@ describe("TimelinePanel", () => {
overlayTimelineSetFilter={isCallEvent}
/>,
);

await waitFor(() =>
expectEvents(container, [
// main timeline events are included
Expand Down
Loading