aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/shared/directories.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/tests/shared/directories.ts')
-rw-r--r--server/tests/shared/directories.ts43
1 files changed, 0 insertions, 43 deletions
diff --git a/server/tests/shared/directories.ts b/server/tests/shared/directories.ts
deleted file mode 100644
index 5ad12d78a..000000000
--- a/server/tests/shared/directories.ts
+++ /dev/null
@@ -1,43 +0,0 @@
1/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
2
3import { expect } from 'chai'
4import { pathExists, readdir } from 'fs-extra'
5import { homedir } from 'os'
6import { join } from 'path'
7import { PeerTubeServer } from '@shared/server-commands'
8import { PeerTubeRunnerProcess } from './peertube-runner-process'
9
10export async function checkTmpIsEmpty (server: PeerTubeServer) {
11 await checkDirectoryIsEmpty(server, 'tmp', [ 'plugins-global.css', 'hls', 'resumable-uploads' ])
12
13 if (await pathExists(server.getDirectoryPath('tmp/hls'))) {
14 await checkDirectoryIsEmpty(server, 'tmp/hls')
15 }
16}
17
18export async function checkPersistentTmpIsEmpty (server: PeerTubeServer) {
19 await checkDirectoryIsEmpty(server, 'tmp-persistent')
20}
21
22export async function checkDirectoryIsEmpty (server: PeerTubeServer, directory: string, exceptions: string[] = []) {
23 const directoryPath = server.getDirectoryPath(directory)
24
25 const directoryExists = await pathExists(directoryPath)
26 expect(directoryExists).to.be.true
27
28 const files = await readdir(directoryPath)
29 const filtered = files.filter(f => exceptions.includes(f) === false)
30
31 expect(filtered).to.have.lengthOf(0)
32}
33
34export async function checkPeerTubeRunnerCacheIsEmpty (runner: PeerTubeRunnerProcess) {
35 const directoryPath = join(homedir(), '.cache', 'peertube-runner-nodejs', runner.getId(), 'transcoding')
36
37 const directoryExists = await pathExists(directoryPath)
38 expect(directoryExists).to.be.true
39
40 const files = await readdir(directoryPath)
41
42 expect(files, 'Directory content: ' + files.join(', ')).to.have.lengthOf(0)
43}