]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/tests/api/notifications/moderation-notifications.ts
Fix missing wait jobs
[github/Chocobozzz/PeerTube.git] / server / tests / api / notifications / moderation-notifications.ts
index c7b9b5fb03a6d8bf4094653d604bf4bd7317cf1d..e7a5c47e953f87ddd10a1687bdbfe15e8745d27c 100644 (file)
@@ -11,7 +11,6 @@ import {
   checkNewInstanceFollower,
   checkNewVideoAbuseForModerators,
   checkNewVideoFromSubscription,
-  checkUserRegistered,
   checkVideoAutoBlacklistForModerators,
   checkVideoIsPublished,
   MockInstancesIndex,
@@ -34,7 +33,7 @@ describe('Test moderation notifications', function () {
   let emails: object[] = []
 
   before(async function () {
-    this.timeout(50000)
+    this.timeout(120000)
 
     const res = await prepareNotificationsTest(3)
     emails = res.emails
@@ -189,7 +188,7 @@ describe('Test moderation notifications', function () {
     })
 
     it('Should send a notification to reporter if the abuse has been accepted', async function () {
-      this.timeout(10000)
+      this.timeout(30000)
 
       await servers[0].abuses.update({ abuseId, body: { state: AbuseState.ACCEPTED } })
       await waitJobs(servers)
@@ -198,7 +197,7 @@ describe('Test moderation notifications', function () {
     })
 
     it('Should send a notification to reporter if the abuse has been rejected', async function () {
-      this.timeout(10000)
+      this.timeout(30000)
 
       await servers[0].abuses.update({ abuseId, body: { state: AbuseState.REJECTED } })
       await waitJobs(servers)
@@ -243,7 +242,7 @@ describe('Test moderation notifications', function () {
     })
 
     it('Should send a notification to reporter on new message', async function () {
-      this.timeout(10000)
+      this.timeout(30000)
 
       const message = 'my super message to users'
       await servers[0].abuses.addMessage({ abuseId, message })
@@ -253,7 +252,7 @@ describe('Test moderation notifications', function () {
     })
 
     it('Should not send a notification to the admin if sent by the admin', async function () {
-      this.timeout(10000)
+      this.timeout(30000)
 
       const message = 'my super message that should not be sent to the admin'
       await servers[0].abuses.addMessage({ abuseId, message })
@@ -264,7 +263,7 @@ describe('Test moderation notifications', function () {
     })
 
     it('Should send a notification to moderators', async function () {
-      this.timeout(10000)
+      this.timeout(30000)
 
       const message = 'my super message to moderators'
       await servers[0].abuses.addMessage({ token: userToken1, abuseId: abuseId2, message })
@@ -275,7 +274,7 @@ describe('Test moderation notifications', function () {
     })
 
     it('Should not send a notification to reporter if sent by the reporter', async function () {
-      this.timeout(10000)
+      this.timeout(30000)
 
       const message = 'my super message that should not be sent to reporter'
       await servers[0].abuses.addMessage({ token: userToken1, abuseId: abuseId2, message })
@@ -299,7 +298,7 @@ describe('Test moderation notifications', function () {
     })
 
     it('Should send a notification to video owner on blacklist', async function () {
-      this.timeout(10000)
+      this.timeout(30000)
 
       const name = 'video for abuse ' + buildUUID()
       const { uuid, shortUUID } = await servers[0].videos.upload({ token: userToken1, attributes: { name } })
@@ -311,7 +310,7 @@ describe('Test moderation notifications', function () {
     })
 
     it('Should send a notification to video owner on unblacklist', async function () {
-      this.timeout(10000)
+      this.timeout(30000)
 
       const name = 'video for abuse ' + buildUUID()
       const { uuid, shortUUID } = await servers[0].videos.upload({ token: userToken1, attributes: { name } })
@@ -327,38 +326,12 @@ describe('Test moderation notifications', function () {
     })
   })
 
-  describe('New registration', function () {
-    let baseParams: CheckerBaseParams
-
-    before(() => {
-      baseParams = {
-        server: servers[0],
-        emails,
-        socketNotifications: adminNotifications,
-        token: servers[0].accessToken
-      }
-    })
-
-    it('Should send a notification only to moderators when a user registers on the instance', async function () {
-      this.timeout(10000)
-
-      await servers[0].users.register({ username: 'user_45' })
-
-      await waitJobs(servers)
-
-      await checkUserRegistered({ ...baseParams, username: 'user_45', checkType: 'presence' })
-
-      const userOverride = { socketNotifications: userNotifications, token: userToken1, check: { web: true, mail: false } }
-      await checkUserRegistered({ ...baseParams, ...userOverride, username: 'user_45', checkType: 'absence' })
-    })
-  })
-
   describe('New instance follows', function () {
     const instanceIndexServer = new MockInstancesIndex()
     let config: any
     let baseParams: CheckerBaseParams
 
-    before(async () => {
+    before(async function () {
       baseParams = {
         server: servers[0],
         emails,
@@ -454,7 +427,7 @@ describe('Test moderation notifications', function () {
     let videoName: string
     let currentCustomConfig: CustomConfig
 
-    before(async () => {
+    before(async function () {
 
       adminBaseParamsServer1 = {
         server: servers[0],