diff options
Diffstat (limited to 'server/tests/api/moderation/blocklist.ts')
-rw-r--r-- | server/tests/api/moderation/blocklist.ts | 28 |
1 files changed, 11 insertions, 17 deletions
diff --git a/server/tests/api/moderation/blocklist.ts b/server/tests/api/moderation/blocklist.ts index 00cb6c65c..44e3de4e4 100644 --- a/server/tests/api/moderation/blocklist.ts +++ b/server/tests/api/moderation/blocklist.ts | |||
@@ -9,7 +9,6 @@ import { | |||
9 | createUser, | 9 | createUser, |
10 | doubleFollow, | 10 | doubleFollow, |
11 | flushAndRunMultipleServers, | 11 | flushAndRunMultipleServers, |
12 | getUserNotifications, | ||
13 | getVideosList, | 12 | getVideosList, |
14 | getVideosListWithToken, | 13 | getVideosListWithToken, |
15 | ServerInfo, | 14 | ServerInfo, |
@@ -18,7 +17,7 @@ import { | |||
18 | userLogin, | 17 | userLogin, |
19 | waitJobs | 18 | waitJobs |
20 | } from '@shared/extra-utils' | 19 | } from '@shared/extra-utils' |
21 | import { UserNotification, UserNotificationType, Video } from '@shared/models' | 20 | import { UserNotificationType, Video } from '@shared/models' |
22 | 21 | ||
23 | const expect = chai.expect | 22 | const expect = chai.expect |
24 | 23 | ||
@@ -59,9 +58,8 @@ async function checkCommentNotification ( | |||
59 | 58 | ||
60 | await waitJobs([ mainServer, comment.server ]) | 59 | await waitJobs([ mainServer, comment.server ]) |
61 | 60 | ||
62 | const res = await getUserNotifications(mainServer.url, mainServer.accessToken, 0, 30) | 61 | const { data } = await mainServer.notificationsCommand.list({ start: 0, count: 30 }) |
63 | const commentNotifications = (res.body.data as UserNotification[]) | 62 | const commentNotifications = data.filter(n => n.comment && n.comment.video.uuid === comment.videoUUID && n.createdAt >= createdAt) |
64 | .filter(n => n.comment && n.comment.video.uuid === comment.videoUUID && n.createdAt >= createdAt) | ||
65 | 63 | ||
66 | if (check === 'presence') expect(commentNotifications).to.have.lengthOf(1) | 64 | if (check === 'presence') expect(commentNotifications).to.have.lengthOf(1) |
67 | else expect(commentNotifications).to.have.lengthOf(0) | 65 | else expect(commentNotifications).to.have.lengthOf(0) |
@@ -710,12 +708,10 @@ describe('Test blocklist', function () { | |||
710 | 708 | ||
711 | await waitJobs(servers) | 709 | await waitJobs(servers) |
712 | 710 | ||
713 | const res = await getUserNotifications(servers[0].url, servers[0].accessToken, 0, 30) | 711 | const { data } = await servers[0].notificationsCommand.list({ start: 0, count: 30 }) |
714 | const commentNotifications = (res.body.data as UserNotification[]) | 712 | const commentNotifications = data.filter(n => { |
715 | .filter(n => { | 713 | return n.type === UserNotificationType.NEW_INSTANCE_FOLLOWER && n.createdAt >= now.toISOString() |
716 | return n.type === UserNotificationType.NEW_INSTANCE_FOLLOWER && | 714 | }) |
717 | n.createdAt >= now.toISOString() | ||
718 | }) | ||
719 | 715 | ||
720 | expect(commentNotifications).to.have.lengthOf(0) | 716 | expect(commentNotifications).to.have.lengthOf(0) |
721 | } | 717 | } |
@@ -773,12 +769,10 @@ describe('Test blocklist', function () { | |||
773 | 769 | ||
774 | await waitJobs(servers) | 770 | await waitJobs(servers) |
775 | 771 | ||
776 | const res = await getUserNotifications(servers[0].url, servers[0].accessToken, 0, 30) | 772 | const { data } = await servers[0].notificationsCommand.list({ start: 0, count: 30 }) |
777 | const commentNotifications = (res.body.data as UserNotification[]) | 773 | const commentNotifications = data.filter(n => { |
778 | .filter(n => { | 774 | return n.type === UserNotificationType.NEW_INSTANCE_FOLLOWER && n.createdAt >= now.toISOString() |
779 | return n.type === UserNotificationType.NEW_INSTANCE_FOLLOWER && | 775 | }) |
780 | n.createdAt >= now.toISOString() | ||
781 | }) | ||
782 | 776 | ||
783 | expect(commentNotifications).to.have.lengthOf(1) | 777 | expect(commentNotifications).to.have.lengthOf(1) |
784 | } | 778 | } |