aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/utils
diff options
context:
space:
mode:
Diffstat (limited to 'server/tests/utils')
-rw-r--r--server/tests/utils/feeds/feeds.ts1
-rw-r--r--server/tests/utils/miscs/miscs.ts4
-rw-r--r--server/tests/utils/users/accounts.ts5
-rw-r--r--server/tests/utils/videos/videos.ts8
4 files changed, 8 insertions, 10 deletions
diff --git a/server/tests/utils/feeds/feeds.ts b/server/tests/utils/feeds/feeds.ts
index ffd23a1ad..fb480b704 100644
--- a/server/tests/utils/feeds/feeds.ts
+++ b/server/tests/utils/feeds/feeds.ts
@@ -1,5 +1,4 @@
1import * as request from 'supertest' 1import * as request from 'supertest'
2import { readFileBufferPromise } from '../../../helpers/core-utils'
3 2
4type FeedType = 'videos' | 'video-comments' 3type FeedType = 'videos' | 'video-comments'
5 4
diff --git a/server/tests/utils/miscs/miscs.ts b/server/tests/utils/miscs/miscs.ts
index b0667491b..b2f80e9b1 100644
--- a/server/tests/utils/miscs/miscs.ts
+++ b/server/tests/utils/miscs/miscs.ts
@@ -4,7 +4,7 @@ import * as chai from 'chai'
4import { isAbsolute, join } from 'path' 4import { isAbsolute, join } from 'path'
5import * as request from 'supertest' 5import * as request from 'supertest'
6import * as WebTorrent from 'webtorrent' 6import * as WebTorrent from 'webtorrent'
7import { readFileBufferPromise } from '../../../helpers/core-utils' 7import { readFile } from 'fs-extra'
8 8
9const expect = chai.expect 9const expect = chai.expect
10let webtorrent = new WebTorrent() 10let webtorrent = new WebTorrent()
@@ -43,7 +43,7 @@ async function testImage (url: string, imageName: string, imagePath: string, ext
43 43
44 const body = res.body 44 const body = res.body
45 45
46 const data = await readFileBufferPromise(join(__dirname, '..', '..', 'fixtures', imageName + extension)) 46 const data = await readFile(join(__dirname, '..', '..', 'fixtures', imageName + extension))
47 const minLength = body.length - ((20 * body.length) / 100) 47 const minLength = body.length - ((20 * body.length) / 100)
48 const maxLength = body.length + ((20 * body.length) / 100) 48 const maxLength = body.length + ((20 * body.length) / 100)
49 49
diff --git a/server/tests/utils/users/accounts.ts b/server/tests/utils/users/accounts.ts
index 024a315c7..f82b8d906 100644
--- a/server/tests/utils/users/accounts.ts
+++ b/server/tests/utils/users/accounts.ts
@@ -1,10 +1,9 @@
1/* tslint:disable:no-unused-expression */ 1/* tslint:disable:no-unused-expression */
2 2
3import { expect } from 'chai' 3import { expect } from 'chai'
4import { existsSync } from 'fs-extra' 4import { existsSync, readdir } from 'fs-extra'
5import { join } from 'path' 5import { join } from 'path'
6import { Account } from '../../../../shared/models/actors' 6import { Account } from '../../../../shared/models/actors'
7import { readdirPromise } from '../../../helpers/core-utils'
8import { root } from '../index' 7import { root } from '../index'
9import { makeGetRequest } from '../requests/requests' 8import { makeGetRequest } from '../requests/requests'
10 9
@@ -47,7 +46,7 @@ async function checkActorFilesWereRemoved (actorUUID: string, serverNumber: numb
47 const directoryExists = existsSync(directoryPath) 46 const directoryExists = existsSync(directoryPath)
48 expect(directoryExists).to.be.true 47 expect(directoryExists).to.be.true
49 48
50 const files = await readdirPromise(directoryPath) 49 const files = await readdir(directoryPath)
51 for (const file of files) { 50 for (const file of files) {
52 expect(file).to.not.contain(actorUUID) 51 expect(file).to.not.contain(actorUUID)
53 } 52 }
diff --git a/server/tests/utils/videos/videos.ts b/server/tests/utils/videos/videos.ts
index 973bbbe87..7eee25402 100644
--- a/server/tests/utils/videos/videos.ts
+++ b/server/tests/utils/videos/videos.ts
@@ -1,13 +1,14 @@
1/* tslint:disable:no-unused-expression */ 1/* tslint:disable:no-unused-expression */
2 2
3import { expect } from 'chai' 3import { expect } from 'chai'
4import { existsSync, readFile } from 'fs-extra' 4import { existsSync, readdir, readFile } from 'fs-extra'
5import * as parseTorrent from 'parse-torrent' 5import * as parseTorrent from 'parse-torrent'
6import { extname, join } from 'path' 6import { extname, join } from 'path'
7import * as request from 'supertest' 7import * as request from 'supertest'
8import { 8import {
9 buildAbsoluteFixturePath, 9 buildAbsoluteFixturePath,
10 getMyUserInformation, immutableAssign, 10 getMyUserInformation,
11 immutableAssign,
11 makeGetRequest, 12 makeGetRequest,
12 makePutBodyRequest, 13 makePutBodyRequest,
13 makeUploadRequest, 14 makeUploadRequest,
@@ -16,7 +17,6 @@ import {
16 testImage 17 testImage
17} from '../' 18} from '../'
18import { VideoDetails, VideoPrivacy } from '../../../../shared/models/videos' 19import { VideoDetails, VideoPrivacy } from '../../../../shared/models/videos'
19import { readdirPromise } from '../../../helpers/core-utils'
20import { VIDEO_CATEGORIES, VIDEO_LANGUAGES, VIDEO_LICENCES, VIDEO_PRIVACIES } from '../../../initializers' 20import { VIDEO_CATEGORIES, VIDEO_LANGUAGES, VIDEO_LICENCES, VIDEO_PRIVACIES } from '../../../initializers'
21import { dateIsValid, webtorrentAdd } from '../index' 21import { dateIsValid, webtorrentAdd } from '../index'
22 22
@@ -276,7 +276,7 @@ async function checkVideoFilesWereRemoved (videoUUID: string, serverNumber: numb
276 const directoryExists = existsSync(directoryPath) 276 const directoryExists = existsSync(directoryPath)
277 expect(directoryExists).to.be.true 277 expect(directoryExists).to.be.true
278 278
279 const files = await readdirPromise(directoryPath) 279 const files = await readdir(directoryPath)
280 for (const file of files) { 280 for (const file of files) {
281 expect(file).to.not.contain(videoUUID) 281 expect(file).to.not.contain(videoUUID)
282 } 282 }