diff options
author | Chocobozzz <me@florianbigard.com> | 2018-02-14 18:21:14 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-02-14 18:33:06 +0100 |
commit | 7b0956ec4f7753c864c4cea220e6f189327baa93 (patch) | |
tree | ed6728632a5a53bcde55978e21c2b7296c104f7e /server/tests/utils/miscs/miscs.ts | |
parent | 3bcfff7f446d0a1d8ef5adf340375e178259a42c (diff) | |
download | PeerTube-7b0956ec4f7753c864c4cea220e6f189327baa93.tar.gz PeerTube-7b0956ec4f7753c864c4cea220e6f189327baa93.tar.zst PeerTube-7b0956ec4f7753c864c4cea220e6f189327baa93.zip |
Fix tests
Diffstat (limited to 'server/tests/utils/miscs/miscs.ts')
-rw-r--r-- | server/tests/utils/miscs/miscs.ts | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/server/tests/utils/miscs/miscs.ts b/server/tests/utils/miscs/miscs.ts index 24cbf59ca..53cb67baf 100644 --- a/server/tests/utils/miscs/miscs.ts +++ b/server/tests/utils/miscs/miscs.ts | |||
@@ -1,10 +1,12 @@ | |||
1 | /* tslint:disable:no-unused-expression */ | 1 | /* tslint:disable:no-unused-expression */ |
2 | 2 | ||
3 | import * as chai from 'chai' | ||
3 | import { isAbsolute, join } from 'path' | 4 | import { isAbsolute, join } from 'path' |
4 | import * as request from 'supertest' | 5 | import * as request from 'supertest' |
5 | import * as WebTorrent from 'webtorrent' | 6 | import * as WebTorrent from 'webtorrent' |
6 | import { readFileBufferPromise } from '../../../helpers/core-utils' | 7 | import { readFileBufferPromise } from '../../../helpers/core-utils' |
7 | 8 | ||
9 | const expect = chai.expect | ||
8 | let webtorrent = new WebTorrent() | 10 | let webtorrent = new WebTorrent() |
9 | 11 | ||
10 | function immutableAssign <T, U> (target: T, source: U) { | 12 | function immutableAssign <T, U> (target: T, source: U) { |
@@ -48,7 +50,8 @@ async function testImage (url: string, imageName: string, imagePath: string, ext | |||
48 | const minLength = body.length - ((20 * body.length) / 100) | 50 | const minLength = body.length - ((20 * body.length) / 100) |
49 | const maxLength = body.length + ((20 * body.length) / 100) | 51 | const maxLength = body.length + ((20 * body.length) / 100) |
50 | 52 | ||
51 | return data.length > minLength && data.length < maxLength | 53 | expect(data.length).to.be.above(minLength) |
54 | expect(data.length).to.be.below(maxLength) | ||
52 | } else { | 55 | } else { |
53 | console.log('Do not test images. Enable it by setting NODE_TEST_IMAGE env variable.') | 56 | console.log('Do not test images. Enable it by setting NODE_TEST_IMAGE env variable.') |
54 | return true | 57 | return true |