aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/utils
diff options
context:
space:
mode:
Diffstat (limited to 'server/tests/utils')
-rw-r--r--server/tests/utils/miscs/miscs.ts5
-rw-r--r--server/tests/utils/videos/videos.ts6
2 files changed, 6 insertions, 5 deletions
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 @@
1/* tslint:disable:no-unused-expression */ 1/* tslint:disable:no-unused-expression */
2 2
3import * as chai from 'chai'
3import { isAbsolute, join } from 'path' 4import { isAbsolute, join } from 'path'
4import * as request from 'supertest' 5import * as request from 'supertest'
5import * as WebTorrent from 'webtorrent' 6import * as WebTorrent from 'webtorrent'
6import { readFileBufferPromise } from '../../../helpers/core-utils' 7import { readFileBufferPromise } from '../../../helpers/core-utils'
7 8
9const expect = chai.expect
8let webtorrent = new WebTorrent() 10let webtorrent = new WebTorrent()
9 11
10function immutableAssign <T, U> (target: T, source: U) { 12function immutableAssign <T, U> (target: T, source: U) {
@@ -48,7 +50,8 @@ async function testImage (url: string, imageName: string, imagePath: string, ext
48 const minLength = body.length - ((20 * body.length) / 100) 50 const minLength = body.length - ((20 * body.length) / 100)
49 const maxLength = body.length + ((20 * body.length) / 100) 51 const maxLength = body.length + ((20 * body.length) / 100)
50 52
51 return data.length > minLength && data.length < maxLength 53 expect(data.length).to.be.above(minLength)
54 expect(data.length).to.be.below(maxLength)
52 } else { 55 } else {
53 console.log('Do not test images. Enable it by setting NODE_TEST_IMAGE env variable.') 56 console.log('Do not test images. Enable it by setting NODE_TEST_IMAGE env variable.')
54 return true 57 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 (
445 expect(file.size).to.be.above(minSize).and.below(maxSize) 445 expect(file.size).to.be.above(minSize).and.below(maxSize)
446 446
447 { 447 {
448 const test = await testImage(url, attributes.thumbnailfile || attributes.fixture, videoDetails.thumbnailPath) 448 await testImage(url, attributes.thumbnailfile || attributes.fixture, videoDetails.thumbnailPath)
449 expect(test).to.equal(true)
450 } 449 }
451 450
452 if (attributes.previewfile) { 451 if (attributes.previewfile) {
453 const test = await testImage(url, attributes.previewfile, videoDetails.previewPath) 452 await testImage(url, attributes.previewfile, videoDetails.previewPath)
454 expect(test).to.equal(true)
455 } 453 }
456 454
457 const torrent = await webtorrentAdd(magnetUri, true) 455 const torrent = await webtorrentAdd(magnetUri, true)