diff options
Diffstat (limited to 'server/tests')
-rw-r--r-- | server/tests/api/check-params/user-notifications.ts | 14 |
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 | ||
3 | import 'mocha' | 3 | import 'mocha' |
4 | import * as io from 'socket.io-client' | 4 | import { io } from 'socket.io-client' |
5 | 5 | ||
6 | import { | 6 | import { |
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) |