diff options
author | Chocobozzz <me@florianbigard.com> | 2021-07-01 16:47:14 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-07-01 16:47:14 +0200 |
commit | 06c27593386459b0f6b85fc674460ea5af23f7f1 (patch) | |
tree | 37b126b16b9f482e4c36a01d08434c659882521b /shared/extra-utils | |
parent | 693c6586cb896a84ff0f897b1c242bcf7bdcbaee (diff) | |
download | PeerTube-06c27593386459b0f6b85fc674460ea5af23f7f1.tar.gz PeerTube-06c27593386459b0f6b85fc674460ea5af23f7f1.tar.zst PeerTube-06c27593386459b0f6b85fc674460ea5af23f7f1.zip |
Fix hooks definition
Diffstat (limited to 'shared/extra-utils')
-rw-r--r-- | shared/extra-utils/miscs/miscs.ts | 13 |
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 | ||
3 | import * as chai from 'chai' | 3 | import * as chai from 'chai' |
4 | import * as ffmpeg from 'fluent-ffmpeg' | 4 | import * as ffmpeg from 'fluent-ffmpeg' |
5 | import { ensureDir, pathExists, readFile, stat } from 'fs-extra' | 5 | import { ensureDir, exists, pathExists, readFile, stat } from 'fs-extra' |
6 | import { basename, dirname, isAbsolute, join, resolve } from 'path' | 6 | import { basename, dirname, isAbsolute, join, resolve } from 'path' |
7 | import * as request from 'supertest' | 7 | import * as request from 'supertest' |
8 | import * as WebTorrent from 'webtorrent' | 8 | import * 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 | |||
67 | async 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 | ||
67 | function isGithubCI () { | 73 | function 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 |