Chatwoot/app/javascript/widget/store/modules/specs/conversation/helpers.spec.js
Sojan Jose b6e8173b24
feat: HMAC verification for web widget (#1643)
* feat: HMAC verification for web widget. Let you verify the authenticated contact via HMAC on the web widget to prevent data tampering.
* Add docs for identity-validation

Co-authored-by: Pranav Raj S <pranav@chatwoot.com>
2021-01-17 22:44:03 +05:30

37 lines
914 B
JavaScript

import {
findUndeliveredMessage,
createTemporaryMessage,
} from '../../conversation/helpers';
describe('#findUndeliveredMessage', () => {
it('returns message objects if exist', () => {
const conversation = {
1: {
id: 1,
content: 'Hello',
status: 'in_progress',
},
2: {
id: 2,
content: 'Hello',
status: 'sent',
},
3: {
id: 3,
content: 'How may I help you',
status: 'sent',
},
};
expect(
findUndeliveredMessage(conversation, { content: 'Hello' })
).toStrictEqual([{ id: 1, content: 'Hello', status: 'in_progress' }]);
});
});
describe('#createTemporaryMessage', () => {
it('returns message object', () => {
const message = createTemporaryMessage({ content: 'hello' });
expect(message.content).toBe('hello');
expect(message.status).toBe('in_progress');
});
});