aboutsummaryrefslogtreecommitdiffhomepage
path: root/shared/extra-utils/miscs
diff options
context:
space:
mode:
Diffstat (limited to 'shared/extra-utils/miscs')
-rw-r--r--shared/extra-utils/miscs/miscs.ts13
1 files changed, 10 insertions, 3 deletions
diff --git a/shared/extra-utils/miscs/miscs.ts b/shared/extra-utils/miscs/miscs.ts
index 1cb1cf440..f20be8585 100644
--- a/shared/extra-utils/miscs/miscs.ts
+++ b/shared/extra-utils/miscs/miscs.ts
@@ -2,7 +2,7 @@
2 2
3import * as chai from 'chai' 3import * as chai from 'chai'
4import * as ffmpeg from 'fluent-ffmpeg' 4import * as ffmpeg from 'fluent-ffmpeg'
5import { ensureDir, pathExists, readFile, stat } from 'fs-extra' 5import { ensureDir, exists, pathExists, readFile, stat } from 'fs-extra'
6import { basename, dirname, isAbsolute, join, resolve } from 'path' 6import { basename, dirname, isAbsolute, join, resolve } from 'path'
7import * as request from 'supertest' 7import * as request from 'supertest'
8import * as WebTorrent from 'webtorrent' 8import * as WebTorrent from 'webtorrent'
@@ -60,8 +60,14 @@ async function testImage (url: string, imageName: string, imagePath: string, ext
60 const minLength = body.length - ((30 * body.length) / 100) 60 const minLength = body.length - ((30 * body.length) / 100)
61 const maxLength = body.length + ((30 * body.length) / 100) 61 const maxLength = body.length + ((30 * body.length) / 100)
62 62
63 expect(data.length).to.be.above(minLength, "the generated image is way smaller than the recorded fixture") 63 expect(data.length).to.be.above(minLength, 'the generated image is way smaller than the recorded fixture')
64 expect(data.length).to.be.below(maxLength, "the generated image is way larger than the recorded fixture") 64 expect(data.length).to.be.below(maxLength, 'the generated image is way larger than the recorded fixture')
65}
66
67async function testFileExistsOrNot (server: { internalServerNumber: number }, directory: string, filePath: string, exist: boolean) {
68 const base = buildServerDirectory(server, directory)
69
70 expect(await pathExists(join(base, filePath))).to.equal(exist)
65} 71}
66 72
67function isGithubCI () { 73function isGithubCI () {
@@ -157,6 +163,7 @@ export {
157 testImage, 163 testImage,
158 isGithubCI, 164 isGithubCI,
159 buildAbsoluteFixturePath, 165 buildAbsoluteFixturePath,
166 testFileExistsOrNot,
160 root, 167 root,
161 generateHighBitrateVideo, 168 generateHighBitrateVideo,
162 generateVideoWithFramerate 169 generateVideoWithFramerate