aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/shared/checks.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2022-03-08 08:50:38 +0100
committerChocobozzz <me@florianbigard.com>2022-03-08 08:50:38 +0100
commit4c6d99e5b69b29e19d53ede14414b76beef815e2 (patch)
tree07566f3069fb1c79b21893b90bdf1e23d0542bef /server/tests/shared/checks.ts
parent0c058f256a195b92f124be10109c95d1fbe93ad8 (diff)
downloadPeerTube-4c6d99e5b69b29e19d53ede14414b76beef815e2.tar.gz
PeerTube-4c6d99e5b69b29e19d53ede14414b76beef815e2.tar.zst
PeerTube-4c6d99e5b69b29e19d53ede14414b76beef815e2.zip
Fix channel tests
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..8c8260088 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 - ((30 * data.length) / 100)
39 const maxLength = body.length + ((30 * body.length) / 100) 39 const maxLength = data.length + ((30 * 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) {