Test normalizeChatMessage
This commit is contained in:
parent
3df63e59d3
commit
b9474e61de
|
@ -0,0 +1,23 @@
|
|||
import { Record as ImmutableRecord } from 'immutable';
|
||||
|
||||
import { normalizeAttachment } from '../attachment';
|
||||
import { normalizeChatMessage } from '../chat-message';
|
||||
|
||||
describe('normalizeChatMessage()', () => {
|
||||
it('upgrades attachment to media_attachments', () => {
|
||||
const message = {
|
||||
id: 'abc',
|
||||
attachment: normalizeAttachment({
|
||||
id: 'def',
|
||||
url: 'https://gleasonator.com/favicon.png',
|
||||
}),
|
||||
};
|
||||
|
||||
const result = normalizeChatMessage(message);
|
||||
|
||||
expect(ImmutableRecord.isRecord(result)).toBe(true);
|
||||
expect(result.id).toEqual('abc');
|
||||
expect(result.media_attachments.first()?.id).toEqual('def');
|
||||
expect(result.media_attachments.first()?.preview_url).toEqual('https://gleasonator.com/favicon.png');
|
||||
});
|
||||
});
|
Loading…
Reference in New Issue