]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/tests/api/check-params/user-notifications.ts
Add transcoding module comments
[github/Chocobozzz/PeerTube.git] / server / tests / api / check-params / user-notifications.ts
index 883b1d29c878c15f1bc5f03b7298ed42bcdc20ac..6fa0502bedef1b387056049862b3cd8716803fe5 100644 (file)
@@ -1,7 +1,7 @@
 /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
 
 import 'mocha'
-import * as io from 'socket.io-client'
+import { io } from 'socket.io-client'
 
 import {
   cleanupTests,
@@ -173,7 +173,9 @@ describe('Test user notifications API validators', function () {
       newFollow: UserNotificationSettingValue.WEB,
       newUserRegistration: UserNotificationSettingValue.WEB,
       newInstanceFollower: UserNotificationSettingValue.WEB,
-      autoInstanceFollowing: UserNotificationSettingValue.WEB
+      autoInstanceFollowing: UserNotificationSettingValue.WEB,
+      abuseNewMessage: UserNotificationSettingValue.WEB,
+      abuseStateChange: UserNotificationSettingValue.WEB
     }
 
     it('Should fail with missing fields', async function () {
@@ -233,11 +235,11 @@ describe('Test user notifications API validators', function () {
   })
 
   describe('When connecting to my notification socket', function () {
+
     it('Should fail with no token', function (next) {
       const socket = io(`http://localhost:${server.port}/user-notifications`, { reconnection: false })
 
-      socket.on('error', () => {
-        socket.removeListener('error', this)
+      socket.once('connect_error', function () {
         socket.disconnect()
         next()
       })
@@ -254,8 +256,7 @@ describe('Test user notifications API validators', function () {
         reconnection: false
       })
 
-      socket.on('error', () => {
-        socket.removeListener('error', this)
+      socket.once('connect_error', function () {
         socket.disconnect()
         next()
       })
@@ -272,12 +273,13 @@ describe('Test user notifications API validators', function () {
         reconnection: false
       })
 
-      const errorListener = socket.on('error', err => {
+      function errorListener (err) {
         next(new Error('Error in connection: ' + err))
-      })
+      }
+
+      socket.on('connect_error', errorListener)
 
-      socket.on('connect', async () => {
-        socket.removeListener('error', errorListener)
+      socket.once('connect', async () => {
         socket.disconnect()
 
         await wait(500)