aboutsummaryrefslogtreecommitdiff
path: root/vnext/server/common/MessageUtils.spec.js
blob: 333367950ee8c417db7cb5dc8b4961a5d3757ac8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
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()
    })
})