From 06c27593386459b0f6b85fc674460ea5af23f7f1 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 1 Jul 2021 16:47:14 +0200 Subject: Fix hooks definition --- shared/extra-utils/miscs/miscs.ts | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'shared/extra-utils/miscs') 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 @@ import * as chai from 'chai' import * as ffmpeg from 'fluent-ffmpeg' -import { ensureDir, pathExists, readFile, stat } from 'fs-extra' +import { ensureDir, exists, pathExists, readFile, stat } from 'fs-extra' import { basename, dirname, isAbsolute, join, resolve } from 'path' import * as request from 'supertest' import * as WebTorrent from 'webtorrent' @@ -60,8 +60,14 @@ async function testImage (url: string, imageName: string, imagePath: string, ext const minLength = body.length - ((30 * body.length) / 100) const maxLength = body.length + ((30 * body.length) / 100) - expect(data.length).to.be.above(minLength, "the generated image is way smaller than the recorded fixture") - expect(data.length).to.be.below(maxLength, "the generated image is way larger than the recorded fixture") + expect(data.length).to.be.above(minLength, 'the generated image is way smaller than the recorded fixture') + expect(data.length).to.be.below(maxLength, 'the generated image is way larger than the recorded fixture') +} + +async function testFileExistsOrNot (server: { internalServerNumber: number }, directory: string, filePath: string, exist: boolean) { + const base = buildServerDirectory(server, directory) + + expect(await pathExists(join(base, filePath))).to.equal(exist) } function isGithubCI () { @@ -157,6 +163,7 @@ export { testImage, isGithubCI, buildAbsoluteFixturePath, + testFileExistsOrNot, root, generateHighBitrateVideo, generateVideoWithFramerate -- cgit v1.2.3