diff options
Diffstat (limited to 'vnext/server/common/MessageUtils.spec.js')
-rw-r--r-- | vnext/server/common/MessageUtils.spec.js | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/vnext/server/common/MessageUtils.spec.js b/vnext/server/common/MessageUtils.spec.js new file mode 100644 index 00000000..766b1882 --- /dev/null +++ b/vnext/server/common/MessageUtils.spec.js @@ -0,0 +1,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' + }; + 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(); + }); +}); |