From 06c27593386459b0f6b85fc674460ea5af23f7f1 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 1 Jul 2021 16:47:14 +0200 Subject: Fix hooks definition --- server/tests/api/videos/resumable-upload.ts | 4 ++++ server/tests/api/videos/video-channels.ts | 18 ++++++++++++++---- 2 files changed, 18 insertions(+), 4 deletions(-) (limited to 'server/tests/api') diff --git a/server/tests/api/videos/resumable-upload.ts b/server/tests/api/videos/resumable-upload.ts index af9221c43..4fc3317df 100644 --- a/server/tests/api/videos/resumable-upload.ts +++ b/server/tests/api/videos/resumable-upload.ts @@ -8,6 +8,7 @@ import { HttpStatusCode } from '@shared/core-utils' import { buildAbsoluteFixturePath, buildServerDirectory, + cleanupTests, flushAndRunServer, getMyUserInformation, prepareResumableUpload, @@ -184,4 +185,7 @@ describe('Test resumable upload', function () { }) }) + after(async function () { + await cleanupTests([ server ]) + }) }) diff --git a/server/tests/api/videos/video-channels.ts b/server/tests/api/videos/video-channels.ts index 7e7ad028c..865098777 100644 --- a/server/tests/api/videos/video-channels.ts +++ b/server/tests/api/videos/video-channels.ts @@ -15,6 +15,7 @@ import { getVideoChannel, getVideoChannelVideos, setDefaultVideoChannel, + testFileExistsOrNot, testImage, updateVideo, updateVideoChannelImage, @@ -53,6 +54,9 @@ describe('Test video channels', function () { let videoUUID: string let accountName: string + const avatarPaths: { [ port: number ]: string } = {} + const bannerPaths: { [ port: number ]: string } = {} + before(async function () { this.timeout(60000) @@ -287,9 +291,11 @@ describe('Test video channels', function () { for (const server of servers) { const videoChannel = await findChannel(server, secondVideoChannelId) - await testImage(server.url, 'avatar-resized', videoChannel.avatar.path, '.png') + avatarPaths[server.port] = videoChannel.avatar.path + await testImage(server.url, 'avatar-resized', avatarPaths[server.port], '.png') + await testFileExistsOrNot(server, 'avatars', basename(avatarPaths[server.port]), true) - const row = await getActorImage(server.internalServerNumber, basename(videoChannel.avatar.path)) + const row = await getActorImage(server.internalServerNumber, basename(avatarPaths[server.port])) expect(row.height).to.equal(ACTOR_IMAGES_SIZE.AVATARS.height) expect(row.width).to.equal(ACTOR_IMAGES_SIZE.AVATARS.width) } @@ -314,9 +320,11 @@ describe('Test video channels', function () { const res = await getVideoChannel(server.url, 'second_video_channel@' + servers[0].host) const videoChannel = res.body - await testImage(server.url, 'banner-resized', videoChannel.banner.path) + bannerPaths[server.port] = videoChannel.banner.path + await testImage(server.url, 'banner-resized', bannerPaths[server.port]) + await testFileExistsOrNot(server, 'avatars', basename(bannerPaths[server.port]), true) - const row = await getActorImage(server.internalServerNumber, basename(videoChannel.banner.path)) + const row = await getActorImage(server.internalServerNumber, basename(bannerPaths[server.port])) expect(row.height).to.equal(ACTOR_IMAGES_SIZE.BANNERS.height) expect(row.width).to.equal(ACTOR_IMAGES_SIZE.BANNERS.width) } @@ -336,6 +344,7 @@ describe('Test video channels', function () { for (const server of servers) { const videoChannel = await findChannel(server, secondVideoChannelId) + await testFileExistsOrNot(server, 'avatars', basename(avatarPaths[server.port]), false) expect(videoChannel.avatar).to.be.null } @@ -355,6 +364,7 @@ describe('Test video channels', function () { for (const server of servers) { const videoChannel = await findChannel(server, secondVideoChannelId) + await testFileExistsOrNot(server, 'avatars', basename(bannerPaths[server.port]), false) expect(videoChannel.banner).to.be.null } -- cgit v1.2.3