aboutsummaryrefslogblamecommitdiff
path: root/vnext/server/common/MessageUtils.spec.js
blob: 5e6f64c2f63147432ca297d67d2a53fb5c8f3e69 (plain) (tree)



























                                                                         
                                     















                                                     
import { formatTitle, formatMessage, formatQuote } from './MessageUtils';

describe('Message formatting', () => {
    it('Blog message', () => {
        let msg = {
            'mid': 1,
            'user': {
                'uid': 1,
                'uname': 'ugnich'
            },
            'tags': [
                'yo',
                'people'
            ],
            'body': 'The message'
        };
        expect(formatTitle(msg)).toMatchSnapshot();
        expect(formatQuote(msg)).toMatchSnapshot();
        expect(formatMessage(msg)).toMatchSnapshot();
    });
    it('Reply message', () => {
        let msg = {
            'mid': 1,
            'rid': 1,
            'user': {
                'uid': 1,
                'uname': 'ugnich'
            },
            'replyQuote': '> The message',
            'body': 'The #reply #bla'
        };
        expect(formatTitle(msg)).toMatchSnapshot();
        expect(formatQuote(msg)).toMatchSnapshot();
        expect(formatMessage(msg)).toMatchSnapshot();
    });
    it('PM', () => {
        let msg = {
            'user': {
                'uid': 1,
                'uname': 'ugnich'
            },
            'body': 'The PM'
        };
        expect(formatTitle(msg)).toMatchSnapshot();
        expect(formatMessage(msg)).toMatchSnapshot();
    });
});