diff options
Diffstat (limited to 'server/tests/utils/miscs')
-rw-r--r-- | server/tests/utils/miscs/miscs.ts | 23 |
1 files changed, 0 insertions, 23 deletions
diff --git a/server/tests/utils/miscs/miscs.ts b/server/tests/utils/miscs/miscs.ts index 2c51d1f0a..2aac37791 100644 --- a/server/tests/utils/miscs/miscs.ts +++ b/server/tests/utils/miscs/miscs.ts | |||
@@ -1,5 +1,4 @@ | |||
1 | import * as WebTorrent from 'webtorrent' | 1 | import * as WebTorrent from 'webtorrent' |
2 | import { readFile, readdir } from 'fs' | ||
3 | 2 | ||
4 | let webtorrent = new WebTorrent() | 3 | let webtorrent = new WebTorrent() |
5 | 4 | ||
@@ -7,26 +6,6 @@ function immutableAssign <T, U> (target: T, source: U) { | |||
7 | return Object.assign<{}, T, U>({}, target, source) | 6 | return Object.assign<{}, T, U>({}, target, source) |
8 | } | 7 | } |
9 | 8 | ||
10 | function readFilePromise (path: string) { | ||
11 | return new Promise<Buffer>((res, rej) => { | ||
12 | readFile(path, (err, data) => { | ||
13 | if (err) return rej(err) | ||
14 | |||
15 | return res(data) | ||
16 | }) | ||
17 | }) | ||
18 | } | ||
19 | |||
20 | function readdirPromise (path: string) { | ||
21 | return new Promise<string[]>((res, rej) => { | ||
22 | readdir(path, (err, files) => { | ||
23 | if (err) return rej(err) | ||
24 | |||
25 | return res(files) | ||
26 | }) | ||
27 | }) | ||
28 | } | ||
29 | |||
30 | // Default interval -> 5 minutes | 9 | // Default interval -> 5 minutes |
31 | function dateIsValid (dateString: string, interval = 300000) { | 10 | function dateIsValid (dateString: string, interval = 300000) { |
32 | const dateToCheck = new Date(dateString) | 11 | const dateToCheck = new Date(dateString) |
@@ -48,8 +27,6 @@ function webtorrentAdd (torrent: string, refreshWebTorrent = false) { | |||
48 | // --------------------------------------------------------------------------- | 27 | // --------------------------------------------------------------------------- |
49 | 28 | ||
50 | export { | 29 | export { |
51 | readFilePromise, | ||
52 | readdirPromise, | ||
53 | dateIsValid, | 30 | dateIsValid, |
54 | wait, | 31 | wait, |
55 | webtorrentAdd, | 32 | webtorrentAdd, |