aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2019-04-03 10:26:03 +0200
committerChocobozzz <me@florianbigard.com>2019-04-03 10:26:03 +0200
commit5893593982a45d3be4b89642af67c4ee7f687704 (patch)
treed1a2faeffe0c9212f0310dd5d46797278b1ebbd5 /server/tests
parent5322589d16b6f13bd3e059d67ee569d767289d4c (diff)
downloadPeerTube-5893593982a45d3be4b89642af67c4ee7f687704.tar.gz
PeerTube-5893593982a45d3be4b89642af67c4ee7f687704.tar.zst
PeerTube-5893593982a45d3be4b89642af67c4ee7f687704.zip
Fix notification tests
Diffstat (limited to 'server/tests')
-rw-r--r--server/tests/api/users/user-notifications.ts52
1 files changed, 39 insertions, 13 deletions
diff --git a/server/tests/api/users/user-notifications.ts b/server/tests/api/users/user-notifications.ts
index 1b66df79b..ac47978e2 100644
--- a/server/tests/api/users/user-notifications.ts
+++ b/server/tests/api/users/user-notifications.ts
@@ -19,7 +19,7 @@ import {
19 userLogin, 19 userLogin,
20 wait, 20 wait,
21 getCustomConfig, 21 getCustomConfig,
22 updateCustomConfig 22 updateCustomConfig, getVideoThreadComments, getVideoCommentThreads
23} from '../../../../shared/utils' 23} from '../../../../shared/utils'
24import { killallServers, ServerInfo, uploadVideo } from '../../../../shared/utils/index' 24import { killallServers, ServerInfo, uploadVideo } from '../../../../shared/utils/index'
25import { setAccessTokensToServers } from '../../../../shared/utils/users/login' 25import { setAccessTokensToServers } from '../../../../shared/utils/users/login'
@@ -58,6 +58,7 @@ import { addVideoCommentReply, addVideoCommentThread } from '../../../../shared/
58import * as uuidv4 from 'uuid/v4' 58import * as uuidv4 from 'uuid/v4'
59import { addAccountToAccountBlocklist, removeAccountFromAccountBlocklist } from '../../../../shared/utils/users/blocklist' 59import { addAccountToAccountBlocklist, removeAccountFromAccountBlocklist } from '../../../../shared/utils/users/blocklist'
60import { CustomConfig } from '../../../../shared/models/server' 60import { CustomConfig } from '../../../../shared/models/server'
61import { VideoCommentThreadTree } from '../../../../shared/models/videos/video-comment.model'
61 62
62const expect = chai.expect 63const expect = chai.expect
63 64
@@ -405,10 +406,14 @@ describe('Test users notifications', function () {
405 406
406 await waitJobs(servers) 407 await waitJobs(servers)
407 408
408 const resComment = await addVideoCommentThread(servers[1].url, servers[1].accessToken, uuid, 'comment') 409 await addVideoCommentThread(servers[1].url, servers[1].accessToken, uuid, 'comment')
409 const commentId = resComment.body.comment.id
410 410
411 await waitJobs(servers) 411 await waitJobs(servers)
412
413 const resComment = await getVideoCommentThreads(servers[0].url, uuid, 0, 5)
414 expect(resComment.body.data).to.have.lengthOf(1)
415 const commentId = resComment.body.data[0].id
416
412 await checkNewCommentOnMyVideo(baseParams, uuid, commentId, commentId, 'presence') 417 await checkNewCommentOnMyVideo(baseParams, uuid, commentId, commentId, 'presence')
413 }) 418 })
414 419
@@ -435,13 +440,24 @@ describe('Test users notifications', function () {
435 const uuid = resVideo.body.video.uuid 440 const uuid = resVideo.body.video.uuid
436 await waitJobs(servers) 441 await waitJobs(servers)
437 442
438 const resThread = await addVideoCommentThread(servers[1].url, servers[1].accessToken, uuid, 'comment') 443 {
439 const threadId = resThread.body.comment.id 444 const resThread = await addVideoCommentThread(servers[ 1 ].url, servers[ 1 ].accessToken, uuid, 'comment')
440 445 const threadId = resThread.body.comment.id
441 const resComment = await addVideoCommentReply(servers[1].url, servers[1].accessToken, uuid, threadId, 'reply') 446 await addVideoCommentReply(servers[ 1 ].url, servers[ 1 ].accessToken, uuid, threadId, 'reply')
442 const commentId = resComment.body.comment.id 447 }
443 448
444 await waitJobs(servers) 449 await waitJobs(servers)
450
451 const resThread = await getVideoCommentThreads(servers[0].url, uuid, 0, 5)
452 expect(resThread.body.data).to.have.lengthOf(1)
453 const threadId = resThread.body.data[0].id
454
455 const resComments = await getVideoThreadComments(servers[0].url, uuid, threadId)
456 const tree = resComments.body as VideoCommentThreadTree
457
458 expect(tree.children).to.have.lengthOf(1)
459 const commentId = tree.children[0].comment.id
460
445 await checkNewCommentOnMyVideo(baseParams, uuid, commentId, threadId, 'presence') 461 await checkNewCommentOnMyVideo(baseParams, uuid, commentId, threadId, 'presence')
446 }) 462 })
447 }) 463 })
@@ -554,17 +570,27 @@ describe('Test users notifications', function () {
554 570
555 await waitJobs(servers) 571 await waitJobs(servers)
556 const resThread = await addVideoCommentThread(servers[1].url, servers[1].accessToken, uuid, 'hello @user_1@localhost:9001 1') 572 const resThread = await addVideoCommentThread(servers[1].url, servers[1].accessToken, uuid, 'hello @user_1@localhost:9001 1')
557 const threadId = resThread.body.comment.id 573 const server2ThreadId = resThread.body.comment.id
558 574
559 await waitJobs(servers) 575 await waitJobs(servers)
560 await checkCommentMention(baseParams, uuid, threadId, threadId, 'super root 2 name', 'presence') 576
577 const resThread2 = await getVideoCommentThreads(servers[0].url, uuid, 0, 5)
578 expect(resThread2.body.data).to.have.lengthOf(1)
579 const server1ThreadId = resThread2.body.data[0].id
580 await checkCommentMention(baseParams, uuid, server1ThreadId, server1ThreadId, 'super root 2 name', 'presence')
561 581
562 const text = '@user_1@localhost:9001 hello 2 @root@localhost:9001' 582 const text = '@user_1@localhost:9001 hello 2 @root@localhost:9001'
563 const resComment = await addVideoCommentReply(servers[1].url, servers[1].accessToken, uuid, threadId, text) 583 await addVideoCommentReply(servers[1].url, servers[1].accessToken, uuid, server2ThreadId, text)
564 const commentId = resComment.body.comment.id
565 584
566 await waitJobs(servers) 585 await waitJobs(servers)
567 await checkCommentMention(baseParams, uuid, commentId, threadId, 'super root 2 name', 'presence') 586
587 const resComments = await getVideoThreadComments(servers[0].url, uuid, server1ThreadId)
588 const tree = resComments.body as VideoCommentThreadTree
589
590 expect(tree.children).to.have.lengthOf(1)
591 const commentId = tree.children[0].comment.id
592
593 await checkCommentMention(baseParams, uuid, commentId, server1ThreadId, 'super root 2 name', 'presence')
568 }) 594 })
569 }) 595 })
570 596