X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Ftests%2Fapi%2Fmoderation%2Fblocklist-notification.ts;h=9c2863a58b5de17963bd61aa0421e973ab34e78c;hb=33b91e53d21fba295ecf516b717fb36e91990771;hp=6b56fdd65c347366fc4adc678f8e2caecc42e163;hpb=89d241a79c262b9775c233b73cff080043ebb5e6;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/tests/api/moderation/blocklist-notification.ts b/server/tests/api/moderation/blocklist-notification.ts index 6b56fdd65..9c2863a58 100644 --- a/server/tests/api/moderation/blocklist-notification.ts +++ b/server/tests/api/moderation/blocklist-notification.ts @@ -1,13 +1,17 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ -import 'mocha' -import * as chai from 'chai' -import { cleanupTests, doubleFollow, flushAndRunMultipleServers, ServerInfo, setAccessTokensToServers, waitJobs } from '@shared/extra-utils' +import { expect } from 'chai' import { UserNotificationType } from '@shared/models' - -const expect = chai.expect - -async function checkNotifications (server: ServerInfo, token: string, expected: UserNotificationType[]) { +import { + cleanupTests, + createMultipleServers, + doubleFollow, + PeerTubeServer, + setAccessTokensToServers, + waitJobs +} from '@shared/server-commands' + +async function checkNotifications (server: PeerTubeServer, token: string, expected: UserNotificationType[]) { const { data } = await server.notifications.list({ token, start: 0, count: 10, unread: true }) expect(data).to.have.lengthOf(expected.length) @@ -16,8 +20,8 @@ async function checkNotifications (server: ServerInfo, token: string, expected: } } -describe('Test blocklist', function () { - let servers: ServerInfo[] +describe('Test blocklist notifications', function () { + let servers: PeerTubeServer[] let videoUUID: string let userToken1: string @@ -62,7 +66,7 @@ describe('Test blocklist', function () { before(async function () { this.timeout(60000) - servers = await flushAndRunMultipleServers(2) + servers = await createMultipleServers(2) await setAccessTokensToServers(servers) { @@ -109,8 +113,6 @@ describe('Test blocklist', function () { }) it('Should block an account', async function () { - this.timeout(10000) - await servers[0].blocklist.addToMyBlocklist({ token: userToken1, account: 'user3@' + servers[1].host }) await waitJobs(servers) }) @@ -142,8 +144,6 @@ describe('Test blocklist', function () { }) it('Should block an account', async function () { - this.timeout(10000) - await servers[0].blocklist.addToMyBlocklist({ token: userToken1, server: servers[1].host }) await waitJobs(servers) }) @@ -182,8 +182,6 @@ describe('Test blocklist', function () { }) it('Should block an account', async function () { - this.timeout(10000) - await servers[0].blocklist.addToServerBlocklist({ account: 'user3@' + servers[1].host }) await waitJobs(servers) }) @@ -217,8 +215,6 @@ describe('Test blocklist', function () { }) it('Should block an account', async function () { - this.timeout(10000) - await servers[0].blocklist.addToServerBlocklist({ server: servers[1].host }) await waitJobs(servers) })