From 4c6d99e5b69b29e19d53ede14414b76beef815e2 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 8 Mar 2022 08:50:38 +0100 Subject: Fix channel tests --- server/tests/fixtures/banner-resized.jpg | Bin 88780 -> 59947 bytes server/tests/shared/checks.ts | 12 ++++++------ 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'server') diff --git a/server/tests/fixtures/banner-resized.jpg b/server/tests/fixtures/banner-resized.jpg index 13ea422cb..952732d61 100644 Binary files a/server/tests/fixtures/banner-resized.jpg and b/server/tests/fixtures/banner-resized.jpg 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) { expect(content.toString()).to.not.contain(str) } -async function testImage (url: string, imageName: string, imagePath: string, extension = '.jpg') { +async function testImage (url: string, imageName: string, imageHTTPPath: string, extension = '.jpg') { const res = await makeGetRequest({ url, - path: imagePath, + path: imageHTTPPath, expectedStatus: HttpStatusCode.OK_200 }) const body = res.body const data = await readFile(join(root(), 'server', 'tests', 'fixtures', imageName + extension)) - const minLength = body.length - ((30 * body.length) / 100) - const maxLength = body.length + ((30 * body.length) / 100) + const minLength = data.length - ((30 * data.length) / 100) + const maxLength = data.length + ((30 * data.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(body.length).to.be.above(minLength, 'the generated image is way smaller than the recorded fixture') + expect(body.length).to.be.below(maxLength, 'the generated image is way larger than the recorded fixture') } async function testFileExistsOrNot (server: PeerTubeServer, directory: string, filePath: string, exist: boolean) { -- cgit v1.2.3