aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/utils/miscs
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-01-17 10:32:03 +0100
committerChocobozzz <me@florianbigard.com>2018-01-17 10:41:27 +0100
commitfd206f0b2d7e5c8e00e2817266d90ec54f79e1da (patch)
tree86b096cf2abd7eb49b892de1c9be855f45a41a9c /server/tests/utils/miscs
parent9581cabc596acb18c0ad86bcf3a07c2b45e8e47e (diff)
downloadPeerTube-fd206f0b2d7e5c8e00e2817266d90ec54f79e1da.tar.gz
PeerTube-fd206f0b2d7e5c8e00e2817266d90ec54f79e1da.tar.zst
PeerTube-fd206f0b2d7e5c8e00e2817266d90ec54f79e1da.zip
Add ability to update some configuration keys
Diffstat (limited to 'server/tests/utils/miscs')
-rw-r--r--server/tests/utils/miscs/miscs.ts23
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 @@
1import * as WebTorrent from 'webtorrent' 1import * as WebTorrent from 'webtorrent'
2import { readFile, readdir } from 'fs'
3 2
4let webtorrent = new WebTorrent() 3let 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
10function 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
20function 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
31function dateIsValid (dateString: string, interval = 300000) { 10function 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
50export { 29export {
51 readFilePromise,
52 readdirPromise,
53 dateIsValid, 30 dateIsValid,
54 wait, 31 wait,
55 webtorrentAdd, 32 webtorrentAdd,