mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2025-12-24 20:26:24 +00:00
getUnreadByConversationAndMarkRead: Take 'now' param for reliable tests
This commit is contained in:
@@ -304,6 +304,7 @@ describe('sql/markRead', () => {
|
||||
});
|
||||
|
||||
it('properly starts disappearing message timer, even if message is already read', async () => {
|
||||
const now = Date.now();
|
||||
assert.lengthOf(await _getAllMessages(), 0);
|
||||
|
||||
const start = Date.now();
|
||||
@@ -387,6 +388,7 @@ describe('sql/markRead', () => {
|
||||
conversationId,
|
||||
newestUnreadAt: message4.received_at,
|
||||
readAt,
|
||||
now,
|
||||
});
|
||||
|
||||
assert.lengthOf(markedRead, 1, 'one message marked read');
|
||||
@@ -412,14 +414,14 @@ describe('sql/markRead', () => {
|
||||
assert.strictEqual(sorted[1].id, message2.id, 'checking message 2');
|
||||
assert.isAtMost(
|
||||
sorted[1].expirationStartTimestamp ?? Infinity,
|
||||
Date.now(),
|
||||
now,
|
||||
'checking message 2 expirationStartTimestamp'
|
||||
);
|
||||
|
||||
assert.strictEqual(sorted[3].id, message4.id, 'checking message 4');
|
||||
assert.isAtMost(
|
||||
sorted[3].expirationStartTimestamp ?? Infinity,
|
||||
Date.now(),
|
||||
now,
|
||||
'checking message 4 expirationStartTimestamp'
|
||||
);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user