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(); }); });