aboutsummaryrefslogtreecommitdiff
path: root/vnext/server/common/MessageUtils.spec.js
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2022-10-29 23:35:20 +0300
committerGravatar Vitaly Takmazov2023-01-13 10:37:58 +0300
commit47218df561e877265c739ffab59b760318ea3143 (patch)
tree166dd029133aca8d0d60af50535bb579bd6b8096 /vnext/server/common/MessageUtils.spec.js
parent3a403e4023ce3b7074a7922e7b504263ddc7a3d1 (diff)
Merge server routes from Next version
Diffstat (limited to 'vnext/server/common/MessageUtils.spec.js')
-rw-r--r--vnext/server/common/MessageUtils.spec.js47
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();
+ });
+});