diff --git a/client/src/standalone/videos/embed.ts b/client/src/standalone/videos/embed.ts index da935ef4c..925367bb9 100644 --- a/client/src/standalone/videos/embed.ts +++ b/client/src/standalone/videos/embed.ts @@ -7,7 +7,7 @@ import 'videojs-dock/dist/videojs-dock.es.js' import { VideoDetails } from '../../../../shared' function getVideoUrl (id: string) { - return window.location.origin + '/api/v1/videos/' + videoId + return window.location.origin + '/api/v1/videos/' + id } async function loadVideoInfo (videoId: string): Promise { diff --git a/server/tests/api/fixtures/avatar-resized.png b/server/tests/api/fixtures/avatar-resized.png index e05fc07ce..9d84151f8 100644 Binary files a/server/tests/api/fixtures/avatar-resized.png and b/server/tests/api/fixtures/avatar-resized.png differ diff --git a/server/tests/api/fixtures/avatar2-resized.png b/server/tests/api/fixtures/avatar2-resized.png index a2e2613bf..44149facb 100644 Binary files a/server/tests/api/fixtures/avatar2-resized.png and b/server/tests/api/fixtures/avatar2-resized.png differ diff --git a/server/tests/api/users/users-multiple-servers.ts b/server/tests/api/users/users-multiple-servers.ts index 0483b9c3d..3c4eaff14 100644 --- a/server/tests/api/users/users-multiple-servers.ts +++ b/server/tests/api/users/users-multiple-servers.ts @@ -65,8 +65,7 @@ describe('Test users with multiple servers', function () { const res = await getMyUserInformation(servers[0].url, servers[0].accessToken) user = res.body - const test = await testImage(servers[0].url, 'avatar2-resized', user.account.avatar.path, '.png') - expect(test).to.equal(true) + await testImage(servers[0].url, 'avatar2-resized', user.account.avatar.path, '.png') await wait(5000) }) @@ -83,8 +82,7 @@ describe('Test users with multiple servers', function () { expect(rootServer1Get.name).to.equal('root') expect(rootServer1Get.host).to.equal('localhost:9001') - const test = await testImage(server.url, 'avatar2-resized', rootServer1Get.avatar.path, '.png') - expect(test).to.equal(true) + await testImage(server.url, 'avatar2-resized', rootServer1Get.avatar.path, '.png') } }) diff --git a/server/tests/api/users/users.ts b/server/tests/api/users/users.ts index c23b58089..ac167d4f9 100644 --- a/server/tests/api/users/users.ts +++ b/server/tests/api/users/users.ts @@ -359,8 +359,7 @@ describe('Test users', function () { const res = await getMyUserInformation(server.url, accessTokenUser) const user = res.body - const test = await testImage(server.url, 'avatar-resized', user.account.avatar.path, '.png') - expect(test).to.equal(true) + await testImage(server.url, 'avatar-resized', user.account.avatar.path, '.png') }) it('Should be able to update another user', async function () { diff --git a/server/tests/api/videos/multiple-servers.ts b/server/tests/api/videos/multiple-servers.ts index 3646fbb0f..85d158d61 100644 --- a/server/tests/api/videos/multiple-servers.ts +++ b/server/tests/api/videos/multiple-servers.ts @@ -641,8 +641,7 @@ describe('Test multiple servers', function () { const res = await getVideo(server.url, videoUUID) const video = res.body - const test = await testImage(server.url, 'video_short1-preview.webm', video.previewPath) - expect(test).to.equal(true) + await testImage(server.url, 'video_short1-preview.webm', video.previewPath) } }) }) diff --git a/server/tests/api/videos/single-server.ts b/server/tests/api/videos/single-server.ts index 476a25479..8f55075fb 100644 --- a/server/tests/api/videos/single-server.ts +++ b/server/tests/api/videos/single-server.ts @@ -341,9 +341,7 @@ describe('Test a single server', function () { for (const video of videos) { const videoName = video.name.replace(' name', '') - const test = await testImage(server.url, videoName, video.thumbnailPath) - - expect(test).to.equal(true) + await testImage(server.url, videoName, video.thumbnailPath) } }) diff --git a/server/tests/api/videos/video-comments.ts b/server/tests/api/videos/video-comments.ts index cf8166a96..f83d95088 100644 --- a/server/tests/api/videos/video-comments.ts +++ b/server/tests/api/videos/video-comments.ts @@ -83,8 +83,7 @@ describe('Test video comments', function () { expect(comment.account.name).to.equal('root') expect(comment.account.host).to.equal('localhost:9001') - const test = await testImage(server.url, 'avatar-resized', comment.account.avatar.path, '.png') - expect(test).to.equal(true) + await testImage(server.url, 'avatar-resized', comment.account.avatar.path, '.png') expect(comment.totalReplies).to.equal(0) expect(dateIsValid(comment.createdAt as string)).to.be.true diff --git a/server/tests/utils/miscs/miscs.ts b/server/tests/utils/miscs/miscs.ts index 24cbf59ca..53cb67baf 100644 --- a/server/tests/utils/miscs/miscs.ts +++ b/server/tests/utils/miscs/miscs.ts @@ -1,10 +1,12 @@ /* tslint:disable:no-unused-expression */ +import * as chai from 'chai' import { isAbsolute, join } from 'path' import * as request from 'supertest' import * as WebTorrent from 'webtorrent' import { readFileBufferPromise } from '../../../helpers/core-utils' +const expect = chai.expect let webtorrent = new WebTorrent() function immutableAssign (target: T, source: U) { @@ -48,7 +50,8 @@ async function testImage (url: string, imageName: string, imagePath: string, ext const minLength = body.length - ((20 * body.length) / 100) const maxLength = body.length + ((20 * body.length) / 100) - return data.length > minLength && data.length < maxLength + expect(data.length).to.be.above(minLength) + expect(data.length).to.be.below(maxLength) } else { console.log('Do not test images. Enable it by setting NODE_TEST_IMAGE env variable.') return true diff --git a/server/tests/utils/videos/videos.ts b/server/tests/utils/videos/videos.ts index 8e58f1f0c..9a4af0b9f 100644 --- a/server/tests/utils/videos/videos.ts +++ b/server/tests/utils/videos/videos.ts @@ -445,13 +445,11 @@ async function completeVideoCheck ( expect(file.size).to.be.above(minSize).and.below(maxSize) { - const test = await testImage(url, attributes.thumbnailfile || attributes.fixture, videoDetails.thumbnailPath) - expect(test).to.equal(true) + await testImage(url, attributes.thumbnailfile || attributes.fixture, videoDetails.thumbnailPath) } if (attributes.previewfile) { - const test = await testImage(url, attributes.previewfile, videoDetails.previewPath) - expect(test).to.equal(true) + await testImage(url, attributes.previewfile, videoDetails.previewPath) } const torrent = await webtorrentAdd(magnetUri, true)