diff options
author | Chocobozzz <me@florianbigard.com> | 2020-11-17 14:38:27 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2020-11-17 14:38:27 +0100 |
commit | 45c70083ddb7f57c52e2c587d6e3ab581c657716 (patch) | |
tree | b239cbbcf788d502a95e5c553a6d44e60c0f2c85 /server | |
parent | 9ff36c2d70956d2775d207c7809adb6fe7f2f2a5 (diff) | |
download | PeerTube-45c70083ddb7f57c52e2c587d6e3ab581c657716.tar.gz PeerTube-45c70083ddb7f57c52e2c587d6e3ab581c657716.tar.zst PeerTube-45c70083ddb7f57c52e2c587d6e3ab581c657716.zip |
Add html test for mentions too
Diffstat (limited to 'server')
-rw-r--r-- | server/tests/api/notifications/comments-notifications.ts | 34 |
1 files changed, 24 insertions, 10 deletions
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 () { | |||
25 | let userNotifications: UserNotification[] = [] | 25 | let userNotifications: UserNotification[] = [] |
26 | let emails: object[] = [] | 26 | let emails: object[] = [] |
27 | 27 | ||
28 | const commentText = '**hello** <a href="https://joinpeertube.org">world</a>, <h1>what do you think about peertube?</h1>' | ||
29 | const expectedHtml = '<strong style="-ms-text-size-adjust: 100%; -webkit-text-size-adjust: 100%;">hello</strong> ' + | ||
30 | '<a href="https://joinpeertube.org" target="_blank" rel="noopener noreferrer" style="-ms-text-size-adjust: 100%; ' + | ||
31 | '-webkit-text-size-adjust: 100%; text-decoration: none; color: #f2690d;">world</a>, </p>what do you think about peertube?' | ||
32 | |||
28 | before(async function () { | 33 | before(async function () { |
29 | this.timeout(120000) | 34 | this.timeout(120000) |
30 | 35 | ||
@@ -172,20 +177,12 @@ describe('Test comments notifications', function () { | |||
172 | const resVideo = await uploadVideo(servers[0].url, userAccessToken, { name: 'cool video' }) | 177 | const resVideo = await uploadVideo(servers[0].url, userAccessToken, { name: 'cool video' }) |
173 | const uuid = resVideo.body.video.uuid | 178 | const uuid = resVideo.body.video.uuid |
174 | 179 | ||
175 | const commentText = '**hello** <a href="https://joinpeertube.org">world</a>, <h1>what do you think about peertube?</h1>' | 180 | await addVideoCommentThread(servers[0].url, servers[0].accessToken, uuid, commentText) |
176 | const resComment = await addVideoCommentThread(servers[0].url, servers[0].accessToken, uuid, commentText) | ||
177 | const commentId = resComment.body.comment.id | ||
178 | 181 | ||
179 | await waitJobs(servers) | 182 | await waitJobs(servers) |
180 | await checkNewCommentOnMyVideo(baseParams, uuid, commentId, commentId, 'presence') | ||
181 | 183 | ||
182 | const latestEmail = emails[emails.length - 1] | 184 | const latestEmail = emails[emails.length - 1] |
183 | 185 | expect(latestEmail['html']).to.contain(expectedHtml) | |
184 | const expected = '<strong style="-ms-text-size-adjust: 100%; -webkit-text-size-adjust: 100%;">hello</strong> ' + | ||
185 | '<a href="https://joinpeertube.org" target="_blank" rel="noopener noreferrer" style="-ms-text-size-adjust: 100%; ' + | ||
186 | '-webkit-text-size-adjust: 100%; text-decoration: none; color: #f2690d;">world</a>, </p>what do you think about peertube?' | ||
187 | |||
188 | expect(latestEmail['html']).to.contain(expected) | ||
189 | }) | 186 | }) |
190 | }) | 187 | }) |
191 | 188 | ||
@@ -321,6 +318,23 @@ describe('Test comments notifications', function () { | |||
321 | 318 | ||
322 | await checkCommentMention(baseParams, uuid, commentId, server1ThreadId, 'super root 2 name', 'presence') | 319 | await checkCommentMention(baseParams, uuid, commentId, server1ThreadId, 'super root 2 name', 'presence') |
323 | }) | 320 | }) |
321 | |||
322 | it('Should convert markdown in comment to html', async function () { | ||
323 | this.timeout(10000) | ||
324 | |||
325 | const resVideo = await uploadVideo(servers[0].url, servers[0].accessToken, { name: 'super video' }) | ||
326 | const uuid = resVideo.body.video.uuid | ||
327 | |||
328 | const resThread = await addVideoCommentThread(servers[0].url, servers[0].accessToken, uuid, '@user_1 hello 1') | ||
329 | const threadId = resThread.body.comment.id | ||
330 | |||
331 | await addVideoCommentReply(servers[0].url, servers[0].accessToken, uuid, threadId, '@user_1 ' + commentText) | ||
332 | |||
333 | await waitJobs(servers) | ||
334 | |||
335 | const latestEmail = emails[emails.length - 1] | ||
336 | expect(latestEmail['html']).to.contain(expectedHtml) | ||
337 | }) | ||
324 | }) | 338 | }) |
325 | 339 | ||
326 | after(async function () { | 340 | after(async function () { |