Skip to content

Commit

Permalink
Add more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
MidhunSureshR committed Mar 2, 2025
1 parent c6ff1e7 commit c2079e1
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions test/unit-tests/stores/room-list-v3/RoomListStoreV3-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,5 +154,35 @@ describe("RoomListStoreV3", () => {
"!newroom5:matrix.org",
].forEach((id) => expect(roomIds).toContain(id));
});

it("Room is re-inserted on tag change", async () => {
const { store, rooms, dispatcher } = await getRoomListStore();
const fn = jest.fn();
store.on(LISTS_UPDATE_EVENT, fn);
dispatcher.dispatch(
{
action: "MatrixActions.Room.tags",
room: rooms[10],
},
true,
);
expect(fn).toHaveBeenCalled();
});

it("Room is re-inserted on decryption", async () => {
const { store, rooms, client, dispatcher } = await getRoomListStore();
jest.spyOn(client, "getRoom").mockImplementation(() => rooms[10]);

const fn = jest.fn();
store.on(LISTS_UPDATE_EVENT, fn);
dispatcher.dispatch(
{
action: "MatrixActions.Event.decrypted",
event: { getRoomId: () => rooms[10].roomId },
},
true,
);
expect(fn).toHaveBeenCalled();
});
});
});

0 comments on commit c2079e1

Please sign in to comment.