From 45c70083ddb7f57c52e2c587d6e3ab581c657716 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 17 Nov 2020 14:38:27 +0100 Subject: Add html test for mentions too --- .../api/notifications/comments-notifications.ts | 34 +++++++++++++++------- 1 file changed, 24 insertions(+), 10 deletions(-) (limited to 'server/tests') diff --git a/server/tests/api/notifications/comments-notifications.ts b/server/tests/api/notifications/comments-notifications.ts index fd009e9d9..3da828b6a 100644 --- a/server/tests/api/notifications/comments-notifications.ts +++ b/server/tests/api/notifications/comments-notifications.ts @@ -25,6 +25,11 @@ describe('Test comments notifications', function () { let userNotifications: UserNotification[] = [] let emails: object[] = [] + const commentText = '**hello** world,

what do you think about peertube?

' + const expectedHtml = 'hello ' + + 'world,

what do you think about peertube?' + before(async function () { this.timeout(120000) @@ -172,20 +177,12 @@ describe('Test comments notifications', function () { const resVideo = await uploadVideo(servers[0].url, userAccessToken, { name: 'cool video' }) const uuid = resVideo.body.video.uuid - const commentText = '**hello** world,

what do you think about peertube?

' - const resComment = await addVideoCommentThread(servers[0].url, servers[0].accessToken, uuid, commentText) - const commentId = resComment.body.comment.id + await addVideoCommentThread(servers[0].url, servers[0].accessToken, uuid, commentText) await waitJobs(servers) - await checkNewCommentOnMyVideo(baseParams, uuid, commentId, commentId, 'presence') const latestEmail = emails[emails.length - 1] - - const expected = 'hello ' + - 'world,

what do you think about peertube?' - - expect(latestEmail['html']).to.contain(expected) + expect(latestEmail['html']).to.contain(expectedHtml) }) }) @@ -321,6 +318,23 @@ describe('Test comments notifications', function () { await checkCommentMention(baseParams, uuid, commentId, server1ThreadId, 'super root 2 name', 'presence') }) + + it('Should convert markdown in comment to html', async function () { + this.timeout(10000) + + const resVideo = await uploadVideo(servers[0].url, servers[0].accessToken, { name: 'super video' }) + const uuid = resVideo.body.video.uuid + + const resThread = await addVideoCommentThread(servers[0].url, servers[0].accessToken, uuid, '@user_1 hello 1') + const threadId = resThread.body.comment.id + + await addVideoCommentReply(servers[0].url, servers[0].accessToken, uuid, threadId, '@user_1 ' + commentText) + + await waitJobs(servers) + + const latestEmail = emails[emails.length - 1] + expect(latestEmail['html']).to.contain(expectedHtml) + }) }) after(async function () { -- cgit v1.2.3