From 62689b942b71cd1dd0d050c6ed05f884a0b325c2 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Mon, 27 Aug 2018 16:23:34 +0200 Subject: Correctly migrate to fs-extra --- server/tests/feeds/feeds.ts | 1 - server/tests/utils/feeds/feeds.ts | 1 - server/tests/utils/miscs/miscs.ts | 4 ++-- server/tests/utils/users/accounts.ts | 5 ++--- server/tests/utils/videos/videos.ts | 8 ++++---- 5 files changed, 8 insertions(+), 11 deletions(-) (limited to 'server/tests') diff --git a/server/tests/feeds/feeds.ts b/server/tests/feeds/feeds.ts index 90450a0bb..72c9bf9a0 100644 --- a/server/tests/feeds/feeds.ts +++ b/server/tests/feeds/feeds.ts @@ -13,7 +13,6 @@ import { setAccessTokensToServers, uploadVideo } from '../utils' -import { join } from 'path' import * as libxmljs from 'libxmljs' import { addVideoCommentThread } from '../utils/videos/video-comments' import { waitJobs } from '../utils/server/jobs' 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 @@ import * as request from 'supertest' -import { readFileBufferPromise } from '../../../helpers/core-utils' type FeedType = 'videos' | 'video-comments' 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' import { isAbsolute, join } from 'path' import * as request from 'supertest' import * as WebTorrent from 'webtorrent' -import { readFileBufferPromise } from '../../../helpers/core-utils' +import { readFile } from 'fs-extra' const expect = chai.expect let webtorrent = new WebTorrent() @@ -43,7 +43,7 @@ async function testImage (url: string, imageName: string, imagePath: string, ext const body = res.body - const data = await readFileBufferPromise(join(__dirname, '..', '..', 'fixtures', imageName + extension)) + const data = await readFile(join(__dirname, '..', '..', 'fixtures', imageName + extension)) const minLength = body.length - ((20 * body.length) / 100) const maxLength = body.length + ((20 * body.length) / 100) 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 @@ /* tslint:disable:no-unused-expression */ import { expect } from 'chai' -import { existsSync } from 'fs-extra' +import { existsSync, readdir } from 'fs-extra' import { join } from 'path' import { Account } from '../../../../shared/models/actors' -import { readdirPromise } from '../../../helpers/core-utils' import { root } from '../index' import { makeGetRequest } from '../requests/requests' @@ -47,7 +46,7 @@ async function checkActorFilesWereRemoved (actorUUID: string, serverNumber: numb const directoryExists = existsSync(directoryPath) expect(directoryExists).to.be.true - const files = await readdirPromise(directoryPath) + const files = await readdir(directoryPath) for (const file of files) { expect(file).to.not.contain(actorUUID) } 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 @@ /* tslint:disable:no-unused-expression */ import { expect } from 'chai' -import { existsSync, readFile } from 'fs-extra' +import { existsSync, readdir, readFile } from 'fs-extra' import * as parseTorrent from 'parse-torrent' import { extname, join } from 'path' import * as request from 'supertest' import { buildAbsoluteFixturePath, - getMyUserInformation, immutableAssign, + getMyUserInformation, + immutableAssign, makeGetRequest, makePutBodyRequest, makeUploadRequest, @@ -16,7 +17,6 @@ import { testImage } from '../' import { VideoDetails, VideoPrivacy } from '../../../../shared/models/videos' -import { readdirPromise } from '../../../helpers/core-utils' import { VIDEO_CATEGORIES, VIDEO_LANGUAGES, VIDEO_LICENCES, VIDEO_PRIVACIES } from '../../../initializers' import { dateIsValid, webtorrentAdd } from '../index' @@ -276,7 +276,7 @@ async function checkVideoFilesWereRemoved (videoUUID: string, serverNumber: numb const directoryExists = existsSync(directoryPath) expect(directoryExists).to.be.true - const files = await readdirPromise(directoryPath) + const files = await readdir(directoryPath) for (const file of files) { expect(file).to.not.contain(videoUUID) } -- cgit v1.2.3