X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Ftests%2Fhelpers%2Frequest.ts;h=c9a2eb8310e1e5e557b513cd09e78938ba872b15;hb=ac03618098e430acb21c075bdba57ce6d377b12d;hp=95a74fdfaa0e28e77ed667e72e4578833474051f;hpb=bfe2ef6bfae03444a232883fc7c449206cf3bee4;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/tests/helpers/request.ts b/server/tests/helpers/request.ts index 95a74fdfa..c9a2eb831 100644 --- a/server/tests/helpers/request.ts +++ b/server/tests/helpers/request.ts @@ -1,11 +1,11 @@ -/* tslint:disable:no-unused-expression */ +/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ import 'mocha' -import { doRequest, doRequestAndSaveToFile } from '../../helpers/requests' -import { get4KFileUrl, root, wait } from '../../../shared/utils' -import { join } from 'path' -import { pathExists, remove } from 'fs-extra' import { expect } from 'chai' +import { pathExists, remove } from 'fs-extra' +import { join } from 'path' +import { FIXTURE_URLS, root, wait } from '../../../shared/extra-utils' +import { doRequest, doRequestAndSaveToFile } from '../../helpers/requests' describe('Request helpers', function () { const destPath1 = join(root(), 'test-output-1.txt') @@ -13,7 +13,7 @@ describe('Request helpers', function () { it('Should throw an error when the bytes limit is exceeded for request', async function () { try { - await doRequest({ uri: get4KFileUrl() }, 3) + await doRequest(FIXTURE_URLS.file4K, { bodyKBLimit: 3 }) } catch { return } @@ -23,7 +23,7 @@ describe('Request helpers', function () { it('Should throw an error when the bytes limit is exceeded for request and save file', async function () { try { - await doRequestAndSaveToFile({ uri: get4KFileUrl() }, destPath1, 3) + await doRequestAndSaveToFile(FIXTURE_URLS.file4K, destPath1, { bodyKBLimit: 3 }) } catch { await wait(500) @@ -35,8 +35,8 @@ describe('Request helpers', function () { }) it('Should succeed if the file is below the limit', async function () { - await doRequest({ uri: get4KFileUrl() }, 5) - await doRequestAndSaveToFile({ uri: get4KFileUrl() }, destPath2, 5) + await doRequest(FIXTURE_URLS.file4K, { bodyKBLimit: 5 }) + await doRequestAndSaveToFile(FIXTURE_URLS.file4K, destPath2, { bodyKBLimit: 5 }) expect(await pathExists(destPath2)).to.be.true })