-/* tslint:disable:no-unused-expression */
+/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
import 'mocha'
import * as io from 'socket.io-client'
import {
- flushTests,
+ cleanupTests,
+ flushAndRunServer,
immutableAssign,
- killallServers,
makeGetRequest,
makePostBodyRequest,
makePutBodyRequest,
- flushAndRunServer,
ServerInfo,
setAccessTokensToServers,
wait
commentMention: UserNotificationSettingValue.WEB,
newFollow: UserNotificationSettingValue.WEB,
newUserRegistration: UserNotificationSettingValue.WEB,
- newInstanceFollower: UserNotificationSettingValue.WEB
+ newInstanceFollower: UserNotificationSettingValue.WEB,
+ autoInstanceFollowing: UserNotificationSettingValue.WEB
}
it('Should fail with missing fields', async function () {
describe('When connecting to my notification socket', function () {
it('Should fail with no token', function (next) {
- const socket = io('http://localhost:9001/user-notifications', { reconnection: false })
+ const socket = io(`http://localhost:${server.port}/user-notifications`, { reconnection: false })
socket.on('error', () => {
socket.removeListener('error', this)
})
it('Should fail with an invalid token', function (next) {
- const socket = io('http://localhost:9001/user-notifications', {
+ const socket = io(`http://localhost:${server.port}/user-notifications`, {
query: { accessToken: 'bad_access_token' },
reconnection: false
})
})
it('Should success with the correct token', function (next) {
- const socket = io('http://localhost:9001/user-notifications', {
+ const socket = io(`http://localhost:${server.port}/user-notifications`, {
query: { accessToken: server.accessToken },
reconnection: false
})
})
})
- after(function () {
- killallServers([ server ])
+ after(async function () {
+ await cleanupTests([ server ])
})
})