]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/tests/api/notifications/user-notifications.ts
Fix tests
[github/Chocobozzz/PeerTube.git] / server / tests / api / notifications / user-notifications.ts
index f479e1785509c4ae9e75db7dae37482e74fbe6f3..04abc673825ebf7b625fdf4c3e5ad42d088af03a 100644 (file)
@@ -1,4 +1,4 @@
-/* tslint:disable:no-unused-expression */
+/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
 
 import * as chai from 'chai'
 import 'mocha'
@@ -14,10 +14,13 @@ import {
   getVideoCommentThreads,
   getVideoThreadComments,
   immutableAssign,
+  MockInstancesIndex,
   registerUser,
   removeVideoFromBlacklist,
   reportVideoAbuse,
+  unfollow,
   updateCustomConfig,
+  updateCustomSubConfig,
   updateMyUser,
   updateVideo,
   updateVideoChannel,
@@ -29,6 +32,7 @@ import { setAccessTokensToServers } from '../../../../shared/extra-utils/users/l
 import { waitJobs } from '../../../../shared/extra-utils/server/jobs'
 import { getUserNotificationSocket } from '../../../../shared/extra-utils/socket/socket-io'
 import {
+  checkAutoInstanceFollowing,
   checkCommentMention,
   CheckerBaseParams,
   checkMyVideoImportIsFinished,
@@ -59,7 +63,7 @@ import { addUserSubscription, removeUserSubscription } from '../../../../shared/
 import { VideoPrivacy } from '../../../../shared/models/videos'
 import { getBadVideoUrl, getYoutubeVideoUrl, importVideo } from '../../../../shared/extra-utils/videos/video-imports'
 import { addVideoCommentReply, addVideoCommentThread } from '../../../../shared/extra-utils/videos/video-comments'
-import * as uuidv4 from 'uuid/v4'
+import { v4 as uuidv4 } from 'uuid'
 import { addAccountToAccountBlocklist, removeAccountFromAccountBlocklist } from '../../../../shared/extra-utils/users/blocklist'
 import { CustomConfig } from '../../../../shared/models/server'
 import { VideoCommentThreadTree } from '../../../../shared/models/videos/video-comment.model'
@@ -70,7 +74,7 @@ async function uploadVideoByRemoteAccount (servers: ServerInfo[], additionalPara
   const name = 'remote video ' + uuidv4()
 
   const data = Object.assign({ name }, additionalParams)
-  const res = await uploadVideo(servers[ 1 ].url, servers[ 1 ].accessToken, data)
+  const res = await uploadVideo(servers[1].url, servers[1].accessToken, data)
 
   await waitJobs(servers)
 
@@ -81,7 +85,7 @@ async function uploadVideoByLocalAccount (servers: ServerInfo[], additionalParam
   const name = 'local video ' + uuidv4()
 
   const data = Object.assign({ name }, additionalParams)
-  const res = await uploadVideo(servers[ 0 ].url, servers[ 0 ].accessToken, data)
+  const res = await uploadVideo(servers[0].url, servers[0].accessToken, data)
 
   await waitJobs(servers)
 
@@ -91,9 +95,9 @@ async function uploadVideoByLocalAccount (servers: ServerInfo[], additionalParam
 describe('Test users notifications', function () {
   let servers: ServerInfo[] = []
   let userAccessToken: string
-  let userNotifications: UserNotification[] = []
-  let adminNotifications: UserNotification[] = []
-  let adminNotificationsServer2: UserNotification[] = []
+  const userNotifications: UserNotification[] = []
+  const adminNotifications: UserNotification[] = []
+  const adminNotificationsServer2: UserNotification[] = []
   const emails: object[] = []
   let channelId: number
 
@@ -108,17 +112,19 @@ describe('Test users notifications', function () {
     commentMention: UserNotificationSettingValue.WEB | UserNotificationSettingValue.EMAIL,
     newFollow: UserNotificationSettingValue.WEB | UserNotificationSettingValue.EMAIL,
     newUserRegistration: UserNotificationSettingValue.WEB | UserNotificationSettingValue.EMAIL,
-    newInstanceFollower: UserNotificationSettingValue.WEB | UserNotificationSettingValue.EMAIL
+    newInstanceFollower: UserNotificationSettingValue.WEB | UserNotificationSettingValue.EMAIL,
+    autoInstanceFollowing: UserNotificationSettingValue.WEB | UserNotificationSettingValue.EMAIL
   }
 
   before(async function () {
     this.timeout(120000)
 
-    await MockSmtpServer.Instance.collectEmails(emails)
+    const port = await MockSmtpServer.Instance.collectEmails(emails)
 
     const overrideConfig = {
       smtp: {
-        hostname: 'localhost'
+        hostname: 'localhost',
+        port
       }
     }
     servers = await flushAndRunMultipleServers(3, overrideConfig)
@@ -136,8 +142,8 @@ describe('Test users notifications', function () {
       password: 'super password'
     }
     await createUser({
-      url: servers[ 0 ].url,
-      accessToken: servers[ 0 ].accessToken,
+      url: servers[0].url,
+      accessToken: servers[0].accessToken,
       username: user.username,
       password: user.password,
       videoQuota: 10 * 1000 * 1000
@@ -149,15 +155,15 @@ describe('Test users notifications', function () {
     await updateMyNotificationSettings(servers[1].url, servers[1].accessToken, allNotificationSettings)
 
     {
-      const socket = getUserNotificationSocket(servers[ 0 ].url, userAccessToken)
+      const socket = getUserNotificationSocket(servers[0].url, userAccessToken)
       socket.on('new-notification', n => userNotifications.push(n))
     }
     {
-      const socket = getUserNotificationSocket(servers[ 0 ].url, servers[0].accessToken)
+      const socket = getUserNotificationSocket(servers[0].url, servers[0].accessToken)
       socket.on('new-notification', n => adminNotifications.push(n))
     }
     {
-      const socket = getUserNotificationSocket(servers[ 1 ].url, servers[1].accessToken)
+      const socket = getUserNotificationSocket(servers[1].url, servers[1].accessToken)
       socket.on('new-notification', n => adminNotificationsServer2.push(n))
     }
 
@@ -184,7 +190,7 @@ describe('Test users notifications', function () {
 
       await uploadVideoByLocalAccount(servers)
 
-      const notification = await getLastNotification(servers[ 0 ].url, userAccessToken)
+      const notification = await getLastNotification(servers[0].url, userAccessToken)
       expect(notification).to.be.undefined
 
       expect(emails).to.have.lengthOf(0)
@@ -194,7 +200,7 @@ describe('Test users notifications', function () {
     it('Should send a new video notification if the user follows the local video publisher', async function () {
       this.timeout(15000)
 
-      await addUserSubscription(servers[0].url, userAccessToken, 'root_channel@localhost:9001')
+      await addUserSubscription(servers[0].url, userAccessToken, 'root_channel@localhost:' + servers[0].port)
       await waitJobs(servers)
 
       const { name, uuid } = await uploadVideoByLocalAccount(servers)
@@ -204,7 +210,7 @@ describe('Test users notifications', function () {
     it('Should send a new video notification from a remote account', async function () {
       this.timeout(50000) // Server 2 has transcoding enabled
 
-      await addUserSubscription(servers[0].url, userAccessToken, 'root_channel@localhost:9002')
+      await addUserSubscription(servers[0].url, userAccessToken, 'root_channel@localhost:' + servers[1].port)
       await waitJobs(servers)
 
       const { name, uuid } = await uploadVideoByRemoteAccount(servers)
@@ -215,7 +221,7 @@ describe('Test users notifications', function () {
       this.timeout(20000)
 
       // In 2 seconds
-      let updateAt = new Date(new Date().getTime() + 2000)
+      const updateAt = new Date(new Date().getTime() + 2000)
 
       const data = {
         privacy: VideoPrivacy.PRIVATE,
@@ -234,7 +240,7 @@ describe('Test users notifications', function () {
       this.timeout(50000)
 
       // In 2 seconds
-      let updateAt = new Date(new Date().getTime() + 2000)
+      const updateAt = new Date(new Date().getTime() + 2000)
 
       const data = {
         privacy: VideoPrivacy.PRIVATE,
@@ -253,7 +259,7 @@ describe('Test users notifications', function () {
     it('Should not send a notification before the video is published', async function () {
       this.timeout(20000)
 
-      let updateAt = new Date(new Date().getTime() + 1000000)
+      const updateAt = new Date(new Date().getTime() + 1000000)
 
       const data = {
         privacy: VideoPrivacy.PRIVATE,
@@ -380,7 +386,7 @@ describe('Test users notifications', function () {
     it('Should not send a new comment notification if the account is muted', async function () {
       this.timeout(10000)
 
-      await addAccountToAccountBlocklist(servers[ 0 ].url, userAccessToken, 'root')
+      await addAccountToAccountBlocklist(servers[0].url, userAccessToken, 'root')
 
       const resVideo = await uploadVideo(servers[0].url, userAccessToken, { name: 'super video' })
       const uuid = resVideo.body.video.uuid
@@ -391,7 +397,7 @@ describe('Test users notifications', function () {
       await wait(500)
       await checkNewCommentOnMyVideo(baseParams, uuid, commentId, commentId, 'absence')
 
-      await removeAccountFromAccountBlocklist(servers[ 0 ].url, userAccessToken, 'root')
+      await removeAccountFromAccountBlocklist(servers[0].url, userAccessToken, 'root')
     })
 
     it('Should send a new comment notification after a local comment on my video', async function () {
@@ -450,9 +456,9 @@ describe('Test users notifications', function () {
       await waitJobs(servers)
 
       {
-        const resThread = await addVideoCommentThread(servers[ 1 ].url, servers[ 1 ].accessToken, uuid, 'comment')
+        const resThread = await addVideoCommentThread(servers[1].url, servers[1].accessToken, uuid, 'comment')
         const threadId = resThread.body.comment.id
-        await addVideoCommentReply(servers[ 1 ].url, servers[ 1 ].accessToken, uuid, threadId, 'reply')
+        await addVideoCommentReply(servers[1].url, servers[1].accessToken, uuid, threadId, 'reply')
       }
 
       await waitJobs(servers)
@@ -524,7 +530,7 @@ describe('Test users notifications', function () {
     it('Should not send a new mention notification if the account is muted', async function () {
       this.timeout(10000)
 
-      await addAccountToAccountBlocklist(servers[ 0 ].url, userAccessToken, 'root')
+      await addAccountToAccountBlocklist(servers[0].url, userAccessToken, 'root')
 
       const resVideo = await uploadVideo(servers[0].url, servers[0].accessToken, { name: 'super video' })
       const uuid = resVideo.body.video.uuid
@@ -535,7 +541,7 @@ describe('Test users notifications', function () {
       await wait(500)
       await checkCommentMention(baseParams, uuid, commentId, commentId, 'super root name', 'absence')
 
-      await removeAccountFromAccountBlocklist(servers[ 0 ].url, userAccessToken, 'root')
+      await removeAccountFromAccountBlocklist(servers[0].url, userAccessToken, 'root')
     })
 
     it('Should not send a new mention notification if the remote account mention a local account', async function () {
@@ -578,7 +584,9 @@ describe('Test users notifications', function () {
       const uuid = resVideo.body.video.uuid
 
       await waitJobs(servers)
-      const resThread = await addVideoCommentThread(servers[1].url, servers[1].accessToken, uuid, 'hello @user_1@localhost:9001 1')
+
+      const text1 = `hello @user_1@localhost:${servers[0].port} 1`
+      const resThread = await addVideoCommentThread(servers[1].url, servers[1].accessToken, uuid, text1)
       const server2ThreadId = resThread.body.comment.id
 
       await waitJobs(servers)
@@ -588,8 +596,8 @@ describe('Test users notifications', function () {
       const server1ThreadId = resThread2.body.data[0].id
       await checkCommentMention(baseParams, uuid, server1ThreadId, server1ThreadId, 'super root 2 name', 'presence')
 
-      const text = '@user_1@localhost:9001 hello 2 @root@localhost:9001'
-      await addVideoCommentReply(servers[1].url, servers[1].accessToken, uuid, server2ThreadId, text)
+      const text2 = `@user_1@localhost:${servers[0].port} hello 2 @root@localhost:${servers[0].port}`
+      await addVideoCommentReply(servers[1].url, servers[1].accessToken, uuid, server2ThreadId, text2)
 
       await waitJobs(servers)
 
@@ -603,7 +611,7 @@ describe('Test users notifications', function () {
     })
   })
 
-  describe('Video abuse for moderators notification' , function () {
+  describe('Video abuse for moderators notification', function () {
     let baseParams: CheckerBaseParams
 
     before(() => {
@@ -714,7 +722,7 @@ describe('Test users notifications', function () {
       await uploadVideoByRemoteAccount(servers, { waitTranscoding: false })
       await waitJobs(servers)
 
-      const notification = await getLastNotification(servers[ 0 ].url, userAccessToken)
+      const notification = await getLastNotification(servers[0].url, userAccessToken)
       if (notification) {
         expect(notification.type).to.not.equal(UserNotificationType.MY_VIDEO_PUBLISHED)
       }
@@ -761,7 +769,7 @@ describe('Test users notifications', function () {
       this.timeout(70000)
 
       // In 2 seconds
-      let updateAt = new Date(new Date().getTime() + 2000)
+      const updateAt = new Date(new Date().getTime() + 2000)
 
       const data = {
         privacy: VideoPrivacy.PRIVATE,
@@ -779,7 +787,7 @@ describe('Test users notifications', function () {
     it('Should not send a notification before the video is published', async function () {
       this.timeout(20000)
 
-      let updateAt = new Date(new Date().getTime() + 100000)
+      const updateAt = new Date(new Date().getTime() + 1000000)
 
       const data = {
         privacy: VideoPrivacy.PRIVATE,
@@ -870,7 +878,18 @@ describe('Test users notifications', function () {
     })
   })
 
-  describe('New instance follower', function () {
+  describe('New instance follows', function () {
+    const instanceIndexServer = new MockInstancesIndex()
+    const config = {
+      followings: {
+        instance: {
+          autoFollowIndex: {
+            indexUrl: 'http://localhost:42101/api/v1/instances/hosts',
+            enabled: true
+          }
+        }
+      }
+    }
     let baseParams: CheckerBaseParams
 
     before(async () => {
@@ -880,6 +899,9 @@ describe('Test users notifications', function () {
         socketNotifications: adminNotifications,
         token: servers[0].accessToken
       }
+
+      await instanceIndexServer.initialize()
+      instanceIndexServer.addInstance(servers[1].host)
     })
 
     it('Should send a notification only to admin when there is a new instance follower', async function () {
@@ -889,17 +911,67 @@ describe('Test users notifications', function () {
 
       await waitJobs(servers)
 
-      await checkNewInstanceFollower(baseParams, 'localhost:9003', 'presence')
+      await checkNewInstanceFollower(baseParams, 'localhost:' + servers[2].port, 'presence')
+
+      const userOverride = { socketNotifications: userNotifications, token: userAccessToken, check: { web: true, mail: false } }
+      await checkNewInstanceFollower(immutableAssign(baseParams, userOverride), 'localhost:' + servers[2].port, 'absence')
+    })
+
+    it('Should send a notification on auto follow back', async function () {
+      this.timeout(40000)
+
+      await unfollow(servers[2].url, servers[2].accessToken, servers[0])
+      await waitJobs(servers)
+
+      const config = {
+        followings: {
+          instance: {
+            autoFollowBack: { enabled: true }
+          }
+        }
+      }
+      await updateCustomSubConfig(servers[0].url, servers[0].accessToken, config)
+
+      await follow(servers[2].url, [ servers[0].url ], servers[2].accessToken)
+
+      await waitJobs(servers)
+
+      const followerHost = servers[0].host
+      const followingHost = servers[2].host
+      await checkAutoInstanceFollowing(baseParams, followerHost, followingHost, 'presence')
 
       const userOverride = { socketNotifications: userNotifications, token: userAccessToken, check: { web: true, mail: false } }
-      await checkNewInstanceFollower(immutableAssign(baseParams, userOverride), 'localhost:9003', 'absence')
+      await checkAutoInstanceFollowing(immutableAssign(baseParams, userOverride), followerHost, followingHost, 'absence')
+
+      config.followings.instance.autoFollowBack.enabled = false
+      await updateCustomSubConfig(servers[0].url, servers[0].accessToken, config)
+      await unfollow(servers[0].url, servers[0].accessToken, servers[2])
+      await unfollow(servers[2].url, servers[2].accessToken, servers[0])
+    })
+
+    it('Should send a notification on auto instances index follow', async function () {
+      this.timeout(30000)
+      await unfollow(servers[0].url, servers[0].accessToken, servers[1])
+
+      await updateCustomSubConfig(servers[0].url, servers[0].accessToken, config)
+
+      await wait(5000)
+      await waitJobs(servers)
+
+      const followerHost = servers[0].host
+      const followingHost = servers[1].host
+      await checkAutoInstanceFollowing(baseParams, followerHost, followingHost, 'presence')
+
+      config.followings.instance.autoFollowIndex.enabled = false
+      await updateCustomSubConfig(servers[0].url, servers[0].accessToken, config)
+      await unfollow(servers[0].url, servers[0].accessToken, servers[1])
     })
   })
 
   describe('New actor follow', function () {
     let baseParams: CheckerBaseParams
-    let myChannelName = 'super channel name'
-    let myUserName = 'super user name'
+    const myChannelName = 'super channel name'
+    const myUserName = 'super user name'
 
     before(async () => {
       baseParams = {
@@ -933,44 +1005,45 @@ describe('Test users notifications', function () {
     it('Should notify when a local channel is following one of our channel', async function () {
       this.timeout(10000)
 
-      await addUserSubscription(servers[0].url, servers[0].accessToken, 'user_1_channel@localhost:9001')
+      await addUserSubscription(servers[0].url, servers[0].accessToken, 'user_1_channel@localhost:' + servers[0].port)
       await waitJobs(servers)
 
       await checkNewActorFollow(baseParams, 'channel', 'root', 'super root name', myChannelName, 'presence')
 
-      await removeUserSubscription(servers[0].url, servers[0].accessToken, 'user_1_channel@localhost:9001')
+      await removeUserSubscription(servers[0].url, servers[0].accessToken, 'user_1_channel@localhost:' + servers[0].port)
     })
 
     it('Should notify when a remote channel is following one of our channel', async function () {
       this.timeout(10000)
 
-      await addUserSubscription(servers[1].url, servers[1].accessToken, 'user_1_channel@localhost:9001')
+      await addUserSubscription(servers[1].url, servers[1].accessToken, 'user_1_channel@localhost:' + servers[0].port)
       await waitJobs(servers)
 
       await checkNewActorFollow(baseParams, 'channel', 'root', 'super root 2 name', myChannelName, 'presence')
 
-      await removeUserSubscription(servers[1].url, servers[1].accessToken, 'user_1_channel@localhost:9001')
-    })
-
-    it('Should notify when a local account is following one of our channel', async function () {
-      this.timeout(10000)
-
-      await addUserSubscription(servers[0].url, servers[0].accessToken, 'user_1@localhost:9001')
-
-      await waitJobs(servers)
-
-      await checkNewActorFollow(baseParams, 'account', 'root', 'super root name', myUserName, 'presence')
-    })
-
-    it('Should notify when a remote account is following one of our channel', async function () {
-      this.timeout(10000)
-
-      await addUserSubscription(servers[1].url, servers[1].accessToken, 'user_1@localhost:9001')
-
-      await waitJobs(servers)
-
-      await checkNewActorFollow(baseParams, 'account', 'root', 'super root 2 name', myUserName, 'presence')
-    })
+      await removeUserSubscription(servers[1].url, servers[1].accessToken, 'user_1_channel@localhost:' + servers[0].port)
+    })
+
+    // PeerTube does not support accout -> account follows
+    // it('Should notify when a local account is following one of our channel', async function () {
+    //   this.timeout(10000)
+    //
+    //   await addUserSubscription(servers[0].url, servers[0].accessToken, 'user_1@localhost:' + servers[0].port)
+    //
+    //   await waitJobs(servers)
+    //
+    //   await checkNewActorFollow(baseParams, 'account', 'root', 'super root name', myUserName, 'presence')
+    // })
+
+    // it('Should notify when a remote account is following one of our channel', async function () {
+    //   this.timeout(10000)
+    //
+    //   await addUserSubscription(servers[1].url, servers[1].accessToken, 'user_1@localhost:' + servers[0].port)
+    //
+    //   await waitJobs(servers)
+    //
+    //   await checkNewActorFollow(baseParams, 'account', 'root', 'super root 2 name', myUserName, 'presence')
+    // })
   })
 
   describe('Video-related notifications when video auto-blacklist is enabled', function () {
@@ -1019,8 +1092,8 @@ describe('Test users notifications', function () {
       autoBlacklistTestsCustomConfig.transcoding.enabled = true
       await updateCustomConfig(servers[0].url, servers[0].accessToken, autoBlacklistTestsCustomConfig)
 
-      await addUserSubscription(servers[0].url, servers[0].accessToken, 'user_1_channel@localhost:9001')
-      await addUserSubscription(servers[1].url, servers[1].accessToken, 'user_1_channel@localhost:9001')
+      await addUserSubscription(servers[0].url, servers[0].accessToken, 'user_1_channel@localhost:' + servers[0].port)
+      await addUserSubscription(servers[1].url, servers[1].accessToken, 'user_1_channel@localhost:' + servers[0].port)
 
     })
 
@@ -1071,7 +1144,7 @@ describe('Test users notifications', function () {
     it('Should send unblacklist but not published/subscription notes after unblacklisted if scheduled update pending', async function () {
       this.timeout(20000)
 
-      let updateAt = new Date(new Date().getTime() + 100000)
+      const updateAt = new Date(new Date().getTime() + 1000000)
 
       const name = 'video with auto-blacklist and future schedule ' + uuidv4()
 
@@ -1104,7 +1177,7 @@ describe('Test users notifications', function () {
       this.timeout(20000)
 
       // In 2 seconds
-      let updateAt = new Date(new Date().getTime() + 2000)
+      const updateAt = new Date(new Date().getTime() + 2000)
 
       const name = 'video with schedule done and still auto-blacklisted ' + uuidv4()
 
@@ -1142,33 +1215,33 @@ describe('Test users notifications', function () {
     after(async () => {
       await updateCustomConfig(servers[0].url, servers[0].accessToken, currentCustomConfig)
 
-      await removeUserSubscription(servers[0].url, servers[0].accessToken, 'user_1_channel@localhost:9001')
-      await removeUserSubscription(servers[1].url, servers[1].accessToken, 'user_1_channel@localhost:9001')
+      await removeUserSubscription(servers[0].url, servers[0].accessToken, 'user_1_channel@localhost:' + servers[0].port)
+      await removeUserSubscription(servers[1].url, servers[1].accessToken, 'user_1_channel@localhost:' + servers[0].port)
     })
   })
 
   describe('Mark as read', function () {
     it('Should mark as read some notifications', async function () {
-      const res = await getUserNotifications(servers[ 0 ].url, userAccessToken, 2, 3)
+      const res = await getUserNotifications(servers[0].url, userAccessToken, 2, 3)
       const ids = res.body.data.map(n => n.id)
 
-      await markAsReadNotifications(servers[ 0 ].url, userAccessToken, ids)
+      await markAsReadNotifications(servers[0].url, userAccessToken, ids)
     })
 
     it('Should have the notifications marked as read', async function () {
-      const res = await getUserNotifications(servers[ 0 ].url, userAccessToken, 0, 10)
+      const res = await getUserNotifications(servers[0].url, userAccessToken, 0, 10)
 
       const notifications = res.body.data as UserNotification[]
-      expect(notifications[ 0 ].read).to.be.false
-      expect(notifications[ 1 ].read).to.be.false
-      expect(notifications[ 2 ].read).to.be.true
-      expect(notifications[ 3 ].read).to.be.true
-      expect(notifications[ 4 ].read).to.be.true
-      expect(notifications[ 5 ].read).to.be.false
+      expect(notifications[0].read).to.be.false
+      expect(notifications[1].read).to.be.false
+      expect(notifications[2].read).to.be.true
+      expect(notifications[3].read).to.be.true
+      expect(notifications[4].read).to.be.true
+      expect(notifications[5].read).to.be.false
     })
 
     it('Should only list read notifications', async function () {
-      const res = await getUserNotifications(servers[ 0 ].url, userAccessToken, 0, 10, false)
+      const res = await getUserNotifications(servers[0].url, userAccessToken, 0, 10, false)
 
       const notifications = res.body.data as UserNotification[]
       for (const notification of notifications) {
@@ -1177,7 +1250,7 @@ describe('Test users notifications', function () {
     })
 
     it('Should only list unread notifications', async function () {
-      const res = await getUserNotifications(servers[ 0 ].url, userAccessToken, 0, 10, true)
+      const res = await getUserNotifications(servers[0].url, userAccessToken, 0, 10, true)
 
       const notifications = res.body.data as UserNotification[]
       for (const notification of notifications) {
@@ -1186,9 +1259,9 @@ describe('Test users notifications', function () {
     })
 
     it('Should mark as read all notifications', async function () {
-      await markAsReadAllNotifications(servers[ 0 ].url, userAccessToken)
+      await markAsReadAllNotifications(servers[0].url, userAccessToken)
 
-      const res = await getUserNotifications(servers[ 0 ].url, userAccessToken, 0, 10, true)
+      const res = await getUserNotifications(servers[0].url, userAccessToken, 0, 10, true)
 
       expect(res.body.total).to.equal(0)
       expect(res.body.data).to.have.lengthOf(0)