2021-05-25 08:30:21 +00:00
|
|
|
import conversationMixin from '../conversations';
|
|
|
|
import conversationFixture from './conversationFixtures';
|
|
|
|
import commonHelpers from '../../helper/commons';
|
|
|
|
commonHelpers();
|
|
|
|
|
|
|
|
describe('#conversationMixin', () => {
|
|
|
|
it('should return unread message count 2 if conversation is passed', () => {
|
|
|
|
expect(
|
|
|
|
conversationMixin.methods.unreadMessagesCount(
|
|
|
|
conversationFixture.conversation
|
|
|
|
)
|
|
|
|
).toEqual(2);
|
|
|
|
});
|
|
|
|
it('should return last message if conversation is passed', () => {
|
|
|
|
expect(
|
|
|
|
conversationMixin.methods.lastMessage(conversationFixture.conversation)
|
|
|
|
).toEqual(conversationFixture.lastMessage);
|
|
|
|
});
|
|
|
|
it('should return read messages if conversation is passed', () => {
|
|
|
|
expect(
|
|
|
|
conversationMixin.methods.readMessages(conversationFixture.conversation)
|
|
|
|
).toEqual(conversationFixture.readMessages);
|
|
|
|
});
|
|
|
|
it('should return read messages if conversation is passed', () => {
|
|
|
|
expect(
|
|
|
|
conversationMixin.methods.unReadMessages(conversationFixture.conversation)
|
|
|
|
).toEqual(conversationFixture.unReadMessages);
|
|
|
|
});
|
2022-04-20 10:33:12 +00:00
|
|
|
it('should return the user message read flag', () => {
|
|
|
|
const contactLastSeen = 1649856659;
|
|
|
|
const createdAt = 1649859419;
|
|
|
|
expect(
|
|
|
|
conversationMixin.methods.hasUserReadMessage(createdAt, contactLastSeen)
|
|
|
|
).toEqual(false);
|
|
|
|
});
|
2021-05-25 08:30:21 +00:00
|
|
|
});
|