diff options
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 |