Fix flaky test that raced because we were in the room while the count changed

This commit is contained in:
Andy Balaam 2023-09-22 11:47:30 +01:00
parent 14a622b1e8
commit 10eac43e24

View file

@ -23,6 +23,7 @@ import { HomeserverInstance } from "../../plugins/utils/homeserver";
import { import {
assertRead, assertRead,
assertReadThread, assertReadThread,
assertStillRead,
assertUnread, assertUnread,
assertUnreadThread, assertUnreadThread,
backToThreadsList, backToThreadsList,
@ -263,21 +264,17 @@ describe("Read receipts", () => {
assertRead(room2); assertRead(room2);
}); });
it("A room where all edits are read is still read after restart", () => { it("A room where all edits are read is still read after restart", () => {
// Given an edit made the room unread // Given a message was edited and read
goTo(room2); goTo(room1);
receiveMessages(room2, ["Msg1"]); receiveMessages(room2, ["Msg1", editOf("Msg1", "Msg1 Edit1")]);
assertRead(room2);
receiveMessages(room2, [editOf("Msg1", "Msg1 Edit1")]);
assertUnread(room2, 1); assertUnread(room2, 1);
goTo(room2);
// When I mark it as read
markAsRead(room2);
// Then the room becomes read
assertRead(room2); assertRead(room2);
// And remains so after a reload // When I reload
saveAndReload(); saveAndReload();
// Then the room is still read
assertRead(room2); assertRead(room2);
}); });
}); });