diff options
Diffstat (limited to 'server/tests')
-rw-r--r-- | server/tests/api/activitypub/cleaner.ts | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/server/tests/api/activitypub/cleaner.ts b/server/tests/api/activitypub/cleaner.ts index 7a443b553..dc885023a 100644 --- a/server/tests/api/activitypub/cleaner.ts +++ b/server/tests/api/activitypub/cleaner.ts | |||
@@ -270,6 +270,59 @@ describe('Test AP cleaner', function () { | |||
270 | await checkRemote('kyle') | 270 | await checkRemote('kyle') |
271 | }) | 271 | }) |
272 | 272 | ||
273 | it('Should remove unavailable remote resources', async function () { | ||
274 | this.timeout(240000) | ||
275 | |||
276 | async function expectNotDeleted () { | ||
277 | { | ||
278 | const video = await servers[0].videos.get({ id: uuid }) | ||
279 | |||
280 | expect(video.likes).to.equal(3) | ||
281 | expect(video.dislikes).to.equal(0) | ||
282 | } | ||
283 | |||
284 | { | ||
285 | const { total } = await servers[0].comments.listThreads({ videoId: uuid }) | ||
286 | expect(total).to.equal(3) | ||
287 | } | ||
288 | } | ||
289 | |||
290 | async function expectDeleted () { | ||
291 | { | ||
292 | const video = await servers[0].videos.get({ id: uuid }) | ||
293 | |||
294 | expect(video.likes).to.equal(3) | ||
295 | expect(video.dislikes).to.equal(0) | ||
296 | } | ||
297 | |||
298 | { | ||
299 | const { total } = await servers[0].comments.listThreads({ videoId: videoUUID1 }) | ||
300 | expect(total).to.equal(2) | ||
301 | } | ||
302 | } | ||
303 | |||
304 | const uuid = (await servers[0].videos.quickUpload({ name: 'server 1 video 2' })).uuid | ||
305 | |||
306 | await waitJobs(servers) | ||
307 | |||
308 | for (const server of servers) { | ||
309 | await server.videos.rate({ id: uuid, rating: 'like' }) | ||
310 | await server.comments.createThread({ videoId: uuid, text: 'comment' }) | ||
311 | } | ||
312 | |||
313 | await waitJobs(servers) | ||
314 | |||
315 | await expectNotDeleted() | ||
316 | |||
317 | await servers[1].kill() | ||
318 | |||
319 | await wait(5000) | ||
320 | await expectNotDeleted() | ||
321 | |||
322 | await wait(15000) | ||
323 | await expectDeleted() | ||
324 | }) | ||
325 | |||
273 | after(async function () { | 326 | after(async function () { |
274 | await cleanupTests(servers) | 327 | await cleanupTests(servers) |
275 | }) | 328 | }) |