Skip to content

Commit 0fe0260

Browse files
committed
Add more tests
1 parent 87d8ef7 commit 0fe0260

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

test/unit-tests/stores/room-list-v3/RoomListStoreV3-test.ts

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,5 +154,35 @@ describe("RoomListStoreV3", () => {
154154
"!newroom5:matrix.org",
155155
].forEach((id) => expect(roomIds).toContain(id));
156156
});
157+
158+
it("Room is re-inserted on tag change", async () => {
159+
const { store, rooms, dispatcher } = await getRoomListStore();
160+
const fn = jest.fn();
161+
store.on(LISTS_UPDATE_EVENT, fn);
162+
dispatcher.dispatch(
163+
{
164+
action: "MatrixActions.Room.tags",
165+
room: rooms[10],
166+
},
167+
true,
168+
);
169+
expect(fn).toHaveBeenCalled();
170+
});
171+
172+
it("Room is re-inserted on decryption", async () => {
173+
const { store, rooms, client, dispatcher } = await getRoomListStore();
174+
jest.spyOn(client, "getRoom").mockImplementation(() => rooms[10]);
175+
176+
const fn = jest.fn();
177+
store.on(LISTS_UPDATE_EVENT, fn);
178+
dispatcher.dispatch(
179+
{
180+
action: "MatrixActions.Event.decrypted",
181+
event: { getRoomId: () => rooms[10].roomId },
182+
},
183+
true,
184+
);
185+
expect(fn).toHaveBeenCalled();
186+
});
157187
});
158188
});

0 commit comments

Comments
 (0)