diff options
Diffstat (limited to 'server/tests/shared')
-rw-r--r-- | server/tests/shared/actors.ts | 8 | ||||
-rw-r--r-- | server/tests/shared/directories.ts | 8 | ||||
-rw-r--r-- | server/tests/shared/playlists.ts | 9 |
3 files changed, 7 insertions, 18 deletions
diff --git a/server/tests/shared/actors.ts b/server/tests/shared/actors.ts index f8f4a5137..41fd72e89 100644 --- a/server/tests/shared/actors.ts +++ b/server/tests/shared/actors.ts | |||
@@ -2,8 +2,6 @@ | |||
2 | 2 | ||
3 | import { expect } from 'chai' | 3 | import { expect } from 'chai' |
4 | import { pathExists, readdir } from 'fs-extra' | 4 | import { pathExists, readdir } from 'fs-extra' |
5 | import { join } from 'path' | ||
6 | import { root } from '@shared/core-utils' | ||
7 | import { Account, VideoChannel } from '@shared/models' | 5 | import { Account, VideoChannel } from '@shared/models' |
8 | import { PeerTubeServer } from '@shared/server-commands' | 6 | import { PeerTubeServer } from '@shared/server-commands' |
9 | 7 | ||
@@ -31,11 +29,9 @@ async function expectAccountFollows (options: { | |||
31 | return expectActorFollow({ ...options, data }) | 29 | return expectActorFollow({ ...options, data }) |
32 | } | 30 | } |
33 | 31 | ||
34 | async function checkActorFilesWereRemoved (filename: string, serverNumber: number) { | 32 | async function checkActorFilesWereRemoved (filename: string, server: PeerTubeServer) { |
35 | const testDirectory = 'test' + serverNumber | ||
36 | |||
37 | for (const directory of [ 'avatars' ]) { | 33 | for (const directory of [ 'avatars' ]) { |
38 | const directoryPath = join(root(), testDirectory, directory) | 34 | const directoryPath = server.getDirectoryPath(directory) |
39 | 35 | ||
40 | const directoryExists = await pathExists(directoryPath) | 36 | const directoryExists = await pathExists(directoryPath) |
41 | expect(directoryExists).to.be.true | 37 | expect(directoryExists).to.be.true |
diff --git a/server/tests/shared/directories.ts b/server/tests/shared/directories.ts index c7065a767..90d534a06 100644 --- a/server/tests/shared/directories.ts +++ b/server/tests/shared/directories.ts | |||
@@ -2,22 +2,18 @@ | |||
2 | 2 | ||
3 | import { expect } from 'chai' | 3 | import { expect } from 'chai' |
4 | import { pathExists, readdir } from 'fs-extra' | 4 | import { pathExists, readdir } from 'fs-extra' |
5 | import { join } from 'path' | ||
6 | import { root } from '@shared/core-utils' | ||
7 | import { PeerTubeServer } from '@shared/server-commands' | 5 | import { PeerTubeServer } from '@shared/server-commands' |
8 | 6 | ||
9 | async function checkTmpIsEmpty (server: PeerTubeServer) { | 7 | async function checkTmpIsEmpty (server: PeerTubeServer) { |
10 | await checkDirectoryIsEmpty(server, 'tmp', [ 'plugins-global.css', 'hls', 'resumable-uploads' ]) | 8 | await checkDirectoryIsEmpty(server, 'tmp', [ 'plugins-global.css', 'hls', 'resumable-uploads' ]) |
11 | 9 | ||
12 | if (await pathExists(join('test' + server.internalServerNumber, 'tmp', 'hls'))) { | 10 | if (await pathExists(server.getDirectoryPath('tmp/hls'))) { |
13 | await checkDirectoryIsEmpty(server, 'tmp/hls') | 11 | await checkDirectoryIsEmpty(server, 'tmp/hls') |
14 | } | 12 | } |
15 | } | 13 | } |
16 | 14 | ||
17 | async function checkDirectoryIsEmpty (server: PeerTubeServer, directory: string, exceptions: string[] = []) { | 15 | async function checkDirectoryIsEmpty (server: PeerTubeServer, directory: string, exceptions: string[] = []) { |
18 | const testDirectory = 'test' + server.internalServerNumber | 16 | const directoryPath = server.getDirectoryPath(directory) |
19 | |||
20 | const directoryPath = join(root(), testDirectory, directory) | ||
21 | 17 | ||
22 | const directoryExists = await pathExists(directoryPath) | 18 | const directoryExists = await pathExists(directoryPath) |
23 | expect(directoryExists).to.be.true | 19 | expect(directoryExists).to.be.true |
diff --git a/server/tests/shared/playlists.ts b/server/tests/shared/playlists.ts index fdd541d20..8db303fd8 100644 --- a/server/tests/shared/playlists.ts +++ b/server/tests/shared/playlists.ts | |||
@@ -1,17 +1,14 @@ | |||
1 | import { expect } from 'chai' | 1 | import { expect } from 'chai' |
2 | import { readdir } from 'fs-extra' | 2 | import { readdir } from 'fs-extra' |
3 | import { join } from 'path' | 3 | import { PeerTubeServer } from '@shared/server-commands' |
4 | import { root } from '@shared/core-utils' | ||
5 | 4 | ||
6 | async function checkPlaylistFilesWereRemoved ( | 5 | async function checkPlaylistFilesWereRemoved ( |
7 | playlistUUID: string, | 6 | playlistUUID: string, |
8 | internalServerNumber: number, | 7 | server: PeerTubeServer, |
9 | directories = [ 'thumbnails' ] | 8 | directories = [ 'thumbnails' ] |
10 | ) { | 9 | ) { |
11 | const testDirectory = 'test' + internalServerNumber | ||
12 | |||
13 | for (const directory of directories) { | 10 | for (const directory of directories) { |
14 | const directoryPath = join(root(), testDirectory, directory) | 11 | const directoryPath = server.getDirectoryPath(directory) |
15 | 12 | ||
16 | const files = await readdir(directoryPath) | 13 | const files = await readdir(directoryPath) |
17 | for (const file of files) { | 14 | for (const file of files) { |