aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/shared/checks.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/tests/shared/checks.ts')
-rw-r--r--server/tests/shared/checks.ts12
1 files changed, 6 insertions, 6 deletions
diff --git a/server/tests/shared/checks.ts b/server/tests/shared/checks.ts
index 9ecc84b5d..dcc16d7ea 100644
--- a/server/tests/shared/checks.ts
+++ b/server/tests/shared/checks.ts
@@ -25,21 +25,21 @@ async function expectLogDoesNotContain (server: PeerTubeServer, str: string) {
25 expect(content.toString()).to.not.contain(str) 25 expect(content.toString()).to.not.contain(str)
26} 26}
27 27
28async function testImage (url: string, imageName: string, imagePath: string, extension = '.jpg') { 28async function testImage (url: string, imageName: string, imageHTTPPath: string, extension = '.jpg') {
29 const res = await makeGetRequest({ 29 const res = await makeGetRequest({
30 url, 30 url,
31 path: imagePath, 31 path: imageHTTPPath,
32 expectedStatus: HttpStatusCode.OK_200 32 expectedStatus: HttpStatusCode.OK_200
33 }) 33 })
34 34
35 const body = res.body 35 const body = res.body
36 36
37 const data = await readFile(join(root(), 'server', 'tests', 'fixtures', imageName + extension)) 37 const data = await readFile(join(root(), 'server', 'tests', 'fixtures', imageName + extension))
38 const minLength = body.length - ((30 * body.length) / 100) 38 const minLength = data.length - ((40 * data.length) / 100)
39 const maxLength = body.length + ((30 * body.length) / 100) 39 const maxLength = data.length + ((40 * data.length) / 100)
40 40
41 expect(data.length).to.be.above(minLength, 'the generated image is way smaller than the recorded fixture') 41 expect(body.length).to.be.above(minLength, 'the generated image is way smaller than the recorded fixture')
42 expect(data.length).to.be.below(maxLength, 'the generated image is way larger than the recorded fixture') 42 expect(body.length).to.be.below(maxLength, 'the generated image is way larger than the recorded fixture')
43} 43}
44 44
45async function testFileExistsOrNot (server: PeerTubeServer, directory: string, filePath: string, exist: boolean) { 45async function testFileExistsOrNot (server: PeerTubeServer, directory: string, filePath: string, exist: boolean) {