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

Commit

Permalink
Fix TimelinePanel-test over-driving Thread model into compliance (#11198
Browse files Browse the repository at this point in the history
)
  • Loading branch information
t3chguy authored Jul 7, 2023
1 parent 706a42f commit 118ee89
Showing 1 changed file with 10 additions and 20 deletions.
30 changes: 10 additions & 20 deletions test/components/structures/TimelinePanel-test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -851,22 +851,22 @@ describe("TimelinePanel", () => {
});

it("updates thread previews", async () => {
root.setUnsigned({
"m.relations": {
[THREAD_RELATION_TYPE.name]: {
latest_event: reply1.event,
count: 1,
current_user_participated: true,
},
},
});
mocked(client.supportsThreads).mockReturnValue(true);
reply1.getContent()["m.relates_to"] = {
rel_type: RelationType.Thread,
event_id: root.getId(),
};
reply2.getContent()["m.relates_to"] = {
rel_type: RelationType.Thread,
event_id: root.getId(),
};

const thread = room.createThread(root.getId()!, root, [], true);
// So that we do not have to mock the thread loading
thread.initialEventsFetched = true;
// @ts-ignore
thread.fetchEditsWhereNeeded = () => Promise.resolve();
await thread.addEvent(reply1, true);
await thread.addEvent(reply1, false, true);
await allThreads.getLiveTimeline().addEvent(thread.rootEvent!, { toStartOfTimeline: true });
const replyToEvent = jest.spyOn(thread, "replyToEvent", "get");

Expand All @@ -879,16 +879,6 @@ describe("TimelinePanel", () => {
await dom.findByText("ReplyEvent1");
expect(replyToEvent).toHaveBeenCalled();

root.setUnsigned({
"m.relations": {
[THREAD_RELATION_TYPE.name]: {
latest_event: reply2.event,
count: 2,
current_user_participated: true,
},
},
});

replyToEvent.mockClear();
await thread.addEvent(reply2, false, true);
await dom.findByText("RootEvent");
Expand Down

0 comments on commit 118ee89

Please sign in to comment.