aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/shared
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2022-03-08 11:28:32 +0100
committerChocobozzz <me@florianbigard.com>2022-03-08 11:28:32 +0100
commit7b51ede977c299a74728171d8c124bcc4cbba6ea (patch)
treead189d2ed1f987e2053201166af4e953c46529f5 /server/tests/shared
parentab4b8974997777373a6032073f9c1aaf33ba9931 (diff)
parent70f3012acd239be4567d9d9fa0364be75485ad1c (diff)
downloadPeerTube-7b51ede977c299a74728171d8c124bcc4cbba6ea.tar.gz
PeerTube-7b51ede977c299a74728171d8c124bcc4cbba6ea.tar.zst
PeerTube-7b51ede977c299a74728171d8c124bcc4cbba6ea.zip
Merge branch 'release/4.1.0' into develop
Diffstat (limited to 'server/tests/shared')
-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) {