mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2026-04-20 00:18:45 +01:00
Add "new conversation" composer for direct messages
This commit is contained in:
46
ts/test-both/util/isConversationUnread_test.ts
Normal file
46
ts/test-both/util/isConversationUnread_test.ts
Normal file
@@ -0,0 +1,46 @@
|
||||
// Copyright 2021 Signal Messenger, LLC
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
import { assert } from 'chai';
|
||||
|
||||
import { isConversationUnread } from '../../util/isConversationUnread';
|
||||
|
||||
describe('isConversationUnread', () => {
|
||||
it('returns false if both markedUnread and unreadCount are undefined', () => {
|
||||
assert.isFalse(isConversationUnread({}));
|
||||
assert.isFalse(
|
||||
isConversationUnread({
|
||||
markedUnread: undefined,
|
||||
unreadCount: undefined,
|
||||
})
|
||||
);
|
||||
});
|
||||
|
||||
it('returns false if markedUnread is false', () => {
|
||||
assert.isFalse(isConversationUnread({ markedUnread: false }));
|
||||
});
|
||||
|
||||
it('returns false if unreadCount is 0', () => {
|
||||
assert.isFalse(isConversationUnread({ unreadCount: 0 }));
|
||||
});
|
||||
|
||||
it('returns true if markedUnread is true, regardless of unreadCount', () => {
|
||||
assert.isTrue(isConversationUnread({ markedUnread: true }));
|
||||
assert.isTrue(isConversationUnread({ markedUnread: true, unreadCount: 0 }));
|
||||
assert.isTrue(
|
||||
isConversationUnread({ markedUnread: true, unreadCount: 100 })
|
||||
);
|
||||
});
|
||||
|
||||
it('returns true if unreadCount is positive, regardless of markedUnread', () => {
|
||||
assert.isTrue(isConversationUnread({ unreadCount: 1 }));
|
||||
assert.isTrue(isConversationUnread({ unreadCount: 99 }));
|
||||
assert.isTrue(
|
||||
isConversationUnread({ markedUnread: false, unreadCount: 2 })
|
||||
);
|
||||
});
|
||||
|
||||
it('returns true if both markedUnread is true and unreadCount is positive', () => {
|
||||
assert.isTrue(isConversationUnread({ markedUnread: true, unreadCount: 1 }));
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user