]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/tests/api/activitypub/cleaner.ts
Allow admins to disable two factor auth
[github/Chocobozzz/PeerTube.git] / server / tests / api / activitypub / cleaner.ts
index dc885023ab7af68b661dad055f1be8e08f4babce..eb677912379ad27f2b97b9ad1c1c0b705fff89a6 100644 (file)
@@ -1,7 +1,6 @@
 /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
 
-import 'mocha'
-import * as chai from 'chai'
+import { expect } from 'chai'
 import { wait } from '@shared/core-utils'
 import {
   cleanupTests,
@@ -12,8 +11,6 @@ import {
   waitJobs
 } from '@shared/server-commands'
 
-const expect = chai.expect
-
 describe('Test AP cleaner', function () {
   let servers: PeerTubeServer[] = []
   let videoUUID1: string
@@ -291,12 +288,12 @@ describe('Test AP cleaner', function () {
       {
         const video = await servers[0].videos.get({ id: uuid })
 
-        expect(video.likes).to.equal(3)
+        expect(video.likes).to.equal(2)
         expect(video.dislikes).to.equal(0)
       }
 
       {
-        const { total } = await servers[0].comments.listThreads({ videoId: videoUUID1 })
+        const { total } = await servers[0].comments.listThreads({ videoId: uuid })
         expect(total).to.equal(2)
       }
     }
@@ -319,8 +316,15 @@ describe('Test AP cleaner', function () {
     await wait(5000)
     await expectNotDeleted()
 
-    await wait(15000)
-    await expectDeleted()
+    let continueWhile = true
+
+    do {
+      try {
+        await expectDeleted()
+        continueWhile = false
+      } catch {
+      }
+    } while (continueWhile)
   })
 
   after(async function () {