diff options
-rw-r--r-- | server/tests/fixtures/banner-resized.jpg | bin | 88780 -> 59947 bytes | |||
-rw-r--r-- | server/tests/shared/checks.ts | 12 |
2 files changed, 6 insertions, 6 deletions
diff --git a/server/tests/fixtures/banner-resized.jpg b/server/tests/fixtures/banner-resized.jpg index 13ea422cb..952732d61 100644 --- a/server/tests/fixtures/banner-resized.jpg +++ b/server/tests/fixtures/banner-resized.jpg | |||
Binary files differ | |||
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 | ||
28 | async function testImage (url: string, imageName: string, imagePath: string, extension = '.jpg') { | 28 | async 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 | ||
45 | async function testFileExistsOrNot (server: PeerTubeServer, directory: string, filePath: string, exist: boolean) { | 45 | async function testFileExistsOrNot (server: PeerTubeServer, directory: string, filePath: string, exist: boolean) { |