aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/activitypub/cleaner.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/tests/api/activitypub/cleaner.ts')
-rw-r--r--server/tests/api/activitypub/cleaner.ts50
1 files changed, 24 insertions, 26 deletions
diff --git a/server/tests/api/activitypub/cleaner.ts b/server/tests/api/activitypub/cleaner.ts
index 5b08880bf..dcf758711 100644
--- a/server/tests/api/activitypub/cleaner.ts
+++ b/server/tests/api/activitypub/cleaner.ts
@@ -6,11 +6,8 @@ import {
6 cleanupTests, 6 cleanupTests,
7 doubleFollow, 7 doubleFollow,
8 flushAndRunMultipleServers, 8 flushAndRunMultipleServers,
9 getVideo,
10 rateVideo,
11 ServerInfo, 9 ServerInfo,
12 setAccessTokensToServers, 10 setAccessTokensToServers,
13 uploadVideoAndGetId,
14 wait, 11 wait,
15 waitJobs 12 waitJobs
16} from '@shared/extra-utils' 13} from '@shared/extra-utils'
@@ -49,9 +46,9 @@ describe('Test AP cleaner', function () {
49 // Create 1 comment per video 46 // Create 1 comment per video
50 // Update 1 remote URL and 1 local URL on 47 // Update 1 remote URL and 1 local URL on
51 48
52 videoUUID1 = (await uploadVideoAndGetId({ server: servers[0], videoName: 'server 1' })).uuid 49 videoUUID1 = (await servers[0].videosCommand.quickUpload({ name: 'server 1' })).uuid
53 videoUUID2 = (await uploadVideoAndGetId({ server: servers[1], videoName: 'server 2' })).uuid 50 videoUUID2 = (await servers[1].videosCommand.quickUpload({ name: 'server 2' })).uuid
54 videoUUID3 = (await uploadVideoAndGetId({ server: servers[2], videoName: 'server 3' })).uuid 51 videoUUID3 = (await servers[2].videosCommand.quickUpload({ name: 'server 3' })).uuid
55 52
56 videoUUIDs = [ videoUUID1, videoUUID2, videoUUID3 ] 53 videoUUIDs = [ videoUUID1, videoUUID2, videoUUID3 ]
57 54
@@ -59,7 +56,7 @@ describe('Test AP cleaner', function () {
59 56
60 for (const server of servers) { 57 for (const server of servers) {
61 for (const uuid of videoUUIDs) { 58 for (const uuid of videoUUIDs) {
62 await rateVideo(server.url, server.accessToken, uuid, 'like') 59 await server.videosCommand.rate({ id: uuid, rating: 'like' })
63 await server.commentsCommand.createThread({ videoId: uuid, text: 'comment' }) 60 await server.commentsCommand.createThread({ videoId: uuid, text: 'comment' })
64 } 61 }
65 } 62 }
@@ -70,9 +67,10 @@ describe('Test AP cleaner', function () {
70 it('Should have the correct likes', async function () { 67 it('Should have the correct likes', async function () {
71 for (const server of servers) { 68 for (const server of servers) {
72 for (const uuid of videoUUIDs) { 69 for (const uuid of videoUUIDs) {
73 const res = await getVideo(server.url, uuid) 70 const video = await server.videosCommand.get({ id: uuid })
74 expect(res.body.likes).to.equal(3) 71
75 expect(res.body.dislikes).to.equal(0) 72 expect(video.likes).to.equal(3)
73 expect(video.dislikes).to.equal(0)
76 } 74 }
77 } 75 }
78 }) 76 })
@@ -90,16 +88,16 @@ describe('Test AP cleaner', function () {
90 88
91 // Updated rates of my video 89 // Updated rates of my video
92 { 90 {
93 const res = await getVideo(servers[0].url, videoUUID1) 91 const video = await servers[0].videosCommand.get({ id: videoUUID1 })
94 expect(res.body.likes).to.equal(2) 92 expect(video.likes).to.equal(2)
95 expect(res.body.dislikes).to.equal(0) 93 expect(video.dislikes).to.equal(0)
96 } 94 }
97 95
98 // Did not update rates of a remote video 96 // Did not update rates of a remote video
99 { 97 {
100 const res = await getVideo(servers[0].url, videoUUID2) 98 const video = await servers[0].videosCommand.get({ id: videoUUID2 })
101 expect(res.body.likes).to.equal(3) 99 expect(video.likes).to.equal(3)
102 expect(res.body.dislikes).to.equal(0) 100 expect(video.dislikes).to.equal(0)
103 } 101 }
104 }) 102 })
105 103
@@ -108,7 +106,7 @@ describe('Test AP cleaner', function () {
108 106
109 for (const server of servers) { 107 for (const server of servers) {
110 for (const uuid of videoUUIDs) { 108 for (const uuid of videoUUIDs) {
111 await rateVideo(server.url, server.accessToken, uuid, 'dislike') 109 await server.videosCommand.rate({ id: uuid, rating: 'dislike' })
112 } 110 }
113 } 111 }
114 112
@@ -116,9 +114,9 @@ describe('Test AP cleaner', function () {
116 114
117 for (const server of servers) { 115 for (const server of servers) {
118 for (const uuid of videoUUIDs) { 116 for (const uuid of videoUUIDs) {
119 const res = await getVideo(server.url, uuid) 117 const video = await server.videosCommand.get({ id: uuid })
120 expect(res.body.likes).to.equal(0) 118 expect(video.likes).to.equal(0)
121 expect(res.body.dislikes).to.equal(3) 119 expect(video.dislikes).to.equal(3)
122 } 120 }
123 } 121 }
124 }) 122 })
@@ -137,16 +135,16 @@ describe('Test AP cleaner', function () {
137 135
138 // Updated rates of my video 136 // Updated rates of my video
139 { 137 {
140 const res = await getVideo(servers[0].url, videoUUID1) 138 const video = await servers[0].videosCommand.get({ id: videoUUID1 })
141 expect(res.body.likes).to.equal(0) 139 expect(video.likes).to.equal(0)
142 expect(res.body.dislikes).to.equal(2) 140 expect(video.dislikes).to.equal(2)
143 } 141 }
144 142
145 // Did not update rates of a remote video 143 // Did not update rates of a remote video
146 { 144 {
147 const res = await getVideo(servers[0].url, videoUUID2) 145 const video = await servers[0].videosCommand.get({ id: videoUUID2 })
148 expect(res.body.likes).to.equal(0) 146 expect(video.likes).to.equal(0)
149 expect(res.body.dislikes).to.equal(3) 147 expect(video.dislikes).to.equal(3)
150 } 148 }
151 }) 149 })
152 150