X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Ftests%2Fapi%2Fserver%2Fauto-follows.ts;h=9666e61dd5bd6dc526f4b0a3798ffdb80af83306;hb=e0faa8ad6e18ce6248ef1ec93a59dab5b05be468;hp=ce7b519252517f490bcf891aa31cce117798e8ad;hpb=ac27887774e63d99f4e227fbe18846f143cc4b3c;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/tests/api/server/auto-follows.ts b/server/tests/api/server/auto-follows.ts index ce7b51925..9666e61dd 100644 --- a/server/tests/api/server/auto-follows.ts +++ b/server/tests/api/server/auto-follows.ts @@ -1,16 +1,9 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ -import 'mocha' import * as chai from 'chai' -import { - cleanupTests, - createMultipleServers, - MockInstancesIndex, - PeerTubeServer, - setAccessTokensToServers, - wait, - waitJobs -} from '@shared/extra-utils' +import { MockInstancesIndex } from '@server/tests/shared' +import { wait } from '@shared/core-utils' +import { cleanupTests, createMultipleServers, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@shared/server-commands' const expect = chai.expect @@ -19,16 +12,16 @@ async function checkFollow (follower: PeerTubeServer, following: PeerTubeServer, const body = await following.follows.getFollowers({ start: 0, count: 5, sort: '-createdAt' }) const follow = body.data.find(f => f.follower.host === follower.host && f.state === 'accepted') - if (exists === true) expect(follow).to.exist - else expect(follow).to.be.undefined + if (exists === true) expect(follow, `Follower ${follower.url} should exist on ${following.url}`).to.exist + else expect(follow, `Follower ${follower.url} should not exist on ${following.url}`).to.be.undefined } { const body = await follower.follows.getFollowings({ start: 0, count: 5, sort: '-createdAt' }) const follow = body.data.find(f => f.following.host === following.host && f.state === 'accepted') - if (exists === true) expect(follow).to.exist - else expect(follow).to.be.undefined + if (exists === true) expect(follow, `Following ${following.url} should exist on ${follower.url}`).to.exist + else expect(follow, `Following ${following.url} should not exist on ${follower.url}`).to.be.undefined } } @@ -55,7 +48,7 @@ describe('Test auto follows', function () { let servers: PeerTubeServer[] = [] before(async function () { - this.timeout(30000) + this.timeout(120000) servers = await createMultipleServers(3) @@ -186,6 +179,10 @@ describe('Test auto follows', function () { await checkFollow(servers[0], servers[1], false) await checkFollow(servers[0], servers[2], true) }) + + after(async function () { + await instanceIndexServer.terminate() + }) }) after(async function () {