diff options
author | Chocobozzz <me@florianbigard.com> | 2018-08-27 16:23:34 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-08-27 16:23:34 +0200 |
commit | 62689b942b71cd1dd0d050c6ed05f884a0b325c2 (patch) | |
tree | c45c35d35d7a3e32621fba06edc63646930c8efd /server/tests/utils | |
parent | 84b6dbcc6e8654f39ec798905e1151ba915cd1aa (diff) | |
download | PeerTube-62689b942b71cd1dd0d050c6ed05f884a0b325c2.tar.gz PeerTube-62689b942b71cd1dd0d050c6ed05f884a0b325c2.tar.zst PeerTube-62689b942b71cd1dd0d050c6ed05f884a0b325c2.zip |
Correctly migrate to fs-extra
Diffstat (limited to 'server/tests/utils')
-rw-r--r-- | server/tests/utils/feeds/feeds.ts | 1 | ||||
-rw-r--r-- | server/tests/utils/miscs/miscs.ts | 4 | ||||
-rw-r--r-- | server/tests/utils/users/accounts.ts | 5 | ||||
-rw-r--r-- | server/tests/utils/videos/videos.ts | 8 |
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 @@ | |||
1 | import * as request from 'supertest' | 1 | import * as request from 'supertest' |
2 | import { readFileBufferPromise } from '../../../helpers/core-utils' | ||
3 | 2 | ||
4 | type FeedType = 'videos' | 'video-comments' | 3 | type 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' | |||
4 | import { isAbsolute, join } from 'path' | 4 | import { isAbsolute, join } from 'path' |
5 | import * as request from 'supertest' | 5 | import * as request from 'supertest' |
6 | import * as WebTorrent from 'webtorrent' | 6 | import * as WebTorrent from 'webtorrent' |
7 | import { readFileBufferPromise } from '../../../helpers/core-utils' | 7 | import { readFile } from 'fs-extra' |
8 | 8 | ||
9 | const expect = chai.expect | 9 | const expect = chai.expect |
10 | let webtorrent = new WebTorrent() | 10 | let 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 | ||
3 | import { expect } from 'chai' | 3 | import { expect } from 'chai' |
4 | import { existsSync } from 'fs-extra' | 4 | import { existsSync, readdir } from 'fs-extra' |
5 | import { join } from 'path' | 5 | import { join } from 'path' |
6 | import { Account } from '../../../../shared/models/actors' | 6 | import { Account } from '../../../../shared/models/actors' |
7 | import { readdirPromise } from '../../../helpers/core-utils' | ||
8 | import { root } from '../index' | 7 | import { root } from '../index' |
9 | import { makeGetRequest } from '../requests/requests' | 8 | import { 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 | ||
3 | import { expect } from 'chai' | 3 | import { expect } from 'chai' |
4 | import { existsSync, readFile } from 'fs-extra' | 4 | import { existsSync, readdir, readFile } from 'fs-extra' |
5 | import * as parseTorrent from 'parse-torrent' | 5 | import * as parseTorrent from 'parse-torrent' |
6 | import { extname, join } from 'path' | 6 | import { extname, join } from 'path' |
7 | import * as request from 'supertest' | 7 | import * as request from 'supertest' |
8 | import { | 8 | import { |
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 '../' |
18 | import { VideoDetails, VideoPrivacy } from '../../../../shared/models/videos' | 19 | import { VideoDetails, VideoPrivacy } from '../../../../shared/models/videos' |
19 | import { readdirPromise } from '../../../helpers/core-utils' | ||
20 | import { VIDEO_CATEGORIES, VIDEO_LANGUAGES, VIDEO_LICENCES, VIDEO_PRIVACIES } from '../../../initializers' | 20 | import { VIDEO_CATEGORIES, VIDEO_LANGUAGES, VIDEO_LICENCES, VIDEO_PRIVACIES } from '../../../initializers' |
21 | import { dateIsValid, webtorrentAdd } from '../index' | 21 | import { 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 | } |