feat: Add pending message on dashboard (#1547)
This commit is contained in:
committed by
GitHub
parent
3e61ea5cfa
commit
7c62d3629c
@@ -1,4 +1,8 @@
|
||||
import { getTypingUsersText } from '../commons';
|
||||
import {
|
||||
getTypingUsersText,
|
||||
createPendingMessage,
|
||||
createPendingAttachment,
|
||||
} from '../commons';
|
||||
|
||||
describe('#getTypingUsersText', () => {
|
||||
it('returns the correct text is there is only one typing user', () => {
|
||||
@@ -24,3 +28,70 @@ describe('#getTypingUsersText', () => {
|
||||
).toEqual('Pranav and 3 others are typing');
|
||||
});
|
||||
});
|
||||
|
||||
describe('#createPendingMessage', () => {
|
||||
const message = {
|
||||
message: 'hi',
|
||||
};
|
||||
it('returns the pending message with expected new keys', () => {
|
||||
expect(createPendingMessage(message)).toHaveProperty(
|
||||
'content',
|
||||
'id',
|
||||
'status',
|
||||
'echo_id',
|
||||
'status',
|
||||
'created_at',
|
||||
'message_type',
|
||||
'conversation_id'
|
||||
);
|
||||
});
|
||||
|
||||
it('returns the pending message with status progress', () => {
|
||||
expect(createPendingMessage(message)).toMatchObject({
|
||||
status: 'progress',
|
||||
});
|
||||
});
|
||||
|
||||
it('returns the pending message with same id and echo_id', () => {
|
||||
const pending = createPendingMessage(message);
|
||||
expect(pending).toMatchObject({
|
||||
echo_id: pending.id,
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('#createPendingAttachment', () => {
|
||||
const message = [1, { isPrivate: false }];
|
||||
it('returns the pending message with expected new keys', () => {
|
||||
expect(createPendingAttachment(message)).toHaveProperty(
|
||||
'content',
|
||||
'id',
|
||||
'status',
|
||||
'echo_id',
|
||||
'status',
|
||||
'created_at',
|
||||
'message_type',
|
||||
'conversation_id',
|
||||
'attachments',
|
||||
'private'
|
||||
);
|
||||
});
|
||||
|
||||
it('returns the pending message with status progress', () => {
|
||||
expect(createPendingAttachment(message)).toMatchObject({
|
||||
status: 'progress',
|
||||
});
|
||||
});
|
||||
|
||||
it('returns the pending message with same id and echo_id', () => {
|
||||
const pending = createPendingAttachment(message);
|
||||
expect(pending).toMatchObject({
|
||||
echo_id: pending.id,
|
||||
});
|
||||
});
|
||||
|
||||
it('returns the pending message to have one attachment', () => {
|
||||
const pending = createPendingAttachment(message);
|
||||
expect(pending.attachments.length).toBe(1);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user