aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/check-params/user-notifications.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2020-11-19 08:58:34 +0100
committerChocobozzz <me@florianbigard.com>2020-11-19 09:07:20 +0100
commitfce7fe04eed39e23e76717085e92118e963def81 (patch)
tree767e5c92cbed548d2b5fb27ce1e6236da4ebdbcf /server/tests/api/check-params/user-notifications.ts
parent4ddcb7c3bad4e98d05d25298f7f11353a639b360 (diff)
downloadPeerTube-fce7fe04eed39e23e76717085e92118e963def81.tar.gz
PeerTube-fce7fe04eed39e23e76717085e92118e963def81.tar.zst
PeerTube-fce7fe04eed39e23e76717085e92118e963def81.zip
Update server dependencies
Diffstat (limited to 'server/tests/api/check-params/user-notifications.ts')
-rw-r--r--server/tests/api/check-params/user-notifications.ts14
1 files changed, 6 insertions, 8 deletions
diff --git a/server/tests/api/check-params/user-notifications.ts b/server/tests/api/check-params/user-notifications.ts
index 4aab7eba4..6fa0502be 100644
--- a/server/tests/api/check-params/user-notifications.ts
+++ b/server/tests/api/check-params/user-notifications.ts
@@ -1,7 +1,7 @@
1/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ 1/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
2 2
3import 'mocha' 3import 'mocha'
4import * as io from 'socket.io-client' 4import { io } from 'socket.io-client'
5 5
6import { 6import {
7 cleanupTests, 7 cleanupTests,
@@ -235,11 +235,11 @@ describe('Test user notifications API validators', function () {
235 }) 235 })
236 236
237 describe('When connecting to my notification socket', function () { 237 describe('When connecting to my notification socket', function () {
238
238 it('Should fail with no token', function (next) { 239 it('Should fail with no token', function (next) {
239 const socket = io(`http://localhost:${server.port}/user-notifications`, { reconnection: false }) 240 const socket = io(`http://localhost:${server.port}/user-notifications`, { reconnection: false })
240 241
241 socket.on('error', function () { 242 socket.once('connect_error', function () {
242 socket.removeListener('error', this)
243 socket.disconnect() 243 socket.disconnect()
244 next() 244 next()
245 }) 245 })
@@ -256,8 +256,7 @@ describe('Test user notifications API validators', function () {
256 reconnection: false 256 reconnection: false
257 }) 257 })
258 258
259 socket.on('error', function () { 259 socket.once('connect_error', function () {
260 socket.removeListener('error', this)
261 socket.disconnect() 260 socket.disconnect()
262 next() 261 next()
263 }) 262 })
@@ -278,10 +277,9 @@ describe('Test user notifications API validators', function () {
278 next(new Error('Error in connection: ' + err)) 277 next(new Error('Error in connection: ' + err))
279 } 278 }
280 279
281 socket.on('error', errorListener) 280 socket.on('connect_error', errorListener)
282 281
283 socket.on('connect', async () => { 282 socket.once('connect', async () => {
284 socket.removeListener('error', errorListener)
285 socket.disconnect() 283 socket.disconnect()
286 284
287 await wait(500) 285 await wait(500)