import { buildUUID } from '@server/helpers/uuid'
import { HttpStatusCode } from '@shared/core-utils'
import {
- buildServerDirectory,
cleanupTests,
CLICommand,
doubleFollow,
const expect = chai.expect
-async function countFiles (internalServerNumber: number, directory: string) {
- const files = await readdir(buildServerDirectory({ internalServerNumber }, directory))
+async function countFiles (server: ServerInfo, directory: string) {
+ const files = await readdir(server.serversCommand.buildDirectory(directory))
return files.length
}
-async function assertNotExists (internalServerNumber: number, directory: string, substring: string) {
- const files = await readdir(buildServerDirectory({ internalServerNumber }, directory))
+async function assertNotExists (server: ServerInfo, directory: string, substring: string) {
+ const files = await readdir(server.serversCommand.buildDirectory(directory))
for (const f of files) {
expect(f).to.not.contain(substring)
async function assertCountAreOkay (servers: ServerInfo[]) {
for (const server of servers) {
- const videosCount = await countFiles(server.internalServerNumber, 'videos')
+ const videosCount = await countFiles(server, 'videos')
expect(videosCount).to.equal(8)
- const torrentsCount = await countFiles(server.internalServerNumber, 'torrents')
+ const torrentsCount = await countFiles(server, 'torrents')
expect(torrentsCount).to.equal(16)
- const previewsCount = await countFiles(server.internalServerNumber, 'previews')
+ const previewsCount = await countFiles(server, 'previews')
expect(previewsCount).to.equal(2)
- const thumbnailsCount = await countFiles(server.internalServerNumber, 'thumbnails')
+ const thumbnailsCount = await countFiles(server, 'thumbnails')
expect(thumbnailsCount).to.equal(6)
- const avatarsCount = await countFiles(server.internalServerNumber, 'avatars')
+ const avatarsCount = await countFiles(server, 'avatars')
expect(avatarsCount).to.equal(2)
}
}
it('Should create some dirty files', async function () {
for (let i = 0; i < 2; i++) {
{
- const base = buildServerDirectory(servers[0], 'videos')
+ const base = servers[0].serversCommand.buildDirectory('videos')
const n1 = buildUUID() + '.mp4'
const n2 = buildUUID() + '.webm'
}
{
- const base = buildServerDirectory(servers[0], 'torrents')
+ const base = servers[0].serversCommand.buildDirectory('torrents')
const n1 = buildUUID() + '-240.torrent'
const n2 = buildUUID() + '-480.torrent'
}
{
- const base = buildServerDirectory(servers[0], 'thumbnails')
+ const base = servers[0].serversCommand.buildDirectory('thumbnails')
const n1 = buildUUID() + '.jpg'
const n2 = buildUUID() + '.jpg'
}
{
- const base = buildServerDirectory(servers[0], 'previews')
+ const base = servers[0].serversCommand.buildDirectory('previews')
const n1 = buildUUID() + '.jpg'
const n2 = buildUUID() + '.jpg'
}
{
- const base = buildServerDirectory(servers[0], 'avatars')
+ const base = servers[0].serversCommand.buildDirectory('avatars')
const n1 = buildUUID() + '.png'
const n2 = buildUUID() + '.jpg'
for (const directory of Object.keys(badNames)) {
for (const name of badNames[directory]) {
- await assertNotExists(servers[0].internalServerNumber, directory, name)
+ await assertNotExists(servers[0], directory, name)
}
}
})