diff options
Diffstat (limited to 'shared/extra-utils')
-rw-r--r-- | shared/extra-utils/instances-index/mock-instances-index.ts | 2 | ||||
-rw-r--r-- | shared/extra-utils/miscs/email.ts | 5 | ||||
-rw-r--r-- | shared/extra-utils/moderation/abuses.ts | 28 | ||||
-rw-r--r-- | shared/extra-utils/plugins/mock-blocklist.ts | 2 | ||||
-rw-r--r-- | shared/extra-utils/videos/live.ts | 2 |
5 files changed, 21 insertions, 18 deletions
diff --git a/shared/extra-utils/instances-index/mock-instances-index.ts b/shared/extra-utils/instances-index/mock-instances-index.ts index ea09c9f61..2604eda03 100644 --- a/shared/extra-utils/instances-index/mock-instances-index.ts +++ b/shared/extra-utils/instances-index/mock-instances-index.ts | |||
@@ -4,7 +4,7 @@ export class MockInstancesIndex { | |||
4 | private readonly indexInstances: { host: string, createdAt: string }[] = [] | 4 | private readonly indexInstances: { host: string, createdAt: string }[] = [] |
5 | 5 | ||
6 | initialize () { | 6 | initialize () { |
7 | return new Promise(res => { | 7 | return new Promise<void>(res => { |
8 | const app = express() | 8 | const app = express() |
9 | 9 | ||
10 | app.use('/', (req: express.Request, res: express.Response, next: express.NextFunction) => { | 10 | app.use('/', (req: express.Request, res: express.Response, next: express.NextFunction) => { |
diff --git a/shared/extra-utils/miscs/email.ts b/shared/extra-utils/miscs/email.ts index 15d298a73..758b15b58 100644 --- a/shared/extra-utils/miscs/email.ts +++ b/shared/extra-utils/miscs/email.ts | |||
@@ -1,4 +1,5 @@ | |||
1 | import { ChildProcess, fork } from 'child_process' | 1 | import { ChildProcess, fork } from 'child_process' |
2 | import { join } from 'path' | ||
2 | import { randomInt } from '../../core-utils/miscs/miscs' | 3 | import { randomInt } from '../../core-utils/miscs/miscs' |
3 | import { parallelTests } from '../server/servers' | 4 | import { parallelTests } from '../server/servers' |
4 | 5 | ||
@@ -10,7 +11,7 @@ class MockSmtpServer { | |||
10 | private emails: object[] | 11 | private emails: object[] |
11 | 12 | ||
12 | private constructor () { | 13 | private constructor () { |
13 | this.emailChildProcess = fork(`${__dirname}/email-child-process`, []) | 14 | this.emailChildProcess = fork(join(__dirname, 'email-child-process'), []) |
14 | 15 | ||
15 | this.emailChildProcess.on('message', (msg: any) => { | 16 | this.emailChildProcess.on('message', (msg: any) => { |
16 | if (msg.email) { | 17 | if (msg.email) { |
@@ -27,7 +28,7 @@ class MockSmtpServer { | |||
27 | 28 | ||
28 | if (this.started) { | 29 | if (this.started) { |
29 | this.emails = emailsCollection | 30 | this.emails = emailsCollection |
30 | return res() | 31 | return res(undefined) |
31 | } | 32 | } |
32 | 33 | ||
33 | // ensure maildev isn't started until | 34 | // ensure maildev isn't started until |
diff --git a/shared/extra-utils/moderation/abuses.ts b/shared/extra-utils/moderation/abuses.ts index cb6ca46ef..c0fda722f 100644 --- a/shared/extra-utils/moderation/abuses.ts +++ b/shared/extra-utils/moderation/abuses.ts | |||
@@ -21,19 +21,21 @@ function reportAbuse (options: { | |||
21 | }) { | 21 | }) { |
22 | const path = '/api/v1/abuses' | 22 | const path = '/api/v1/abuses' |
23 | 23 | ||
24 | const video = options.videoId ? { | 24 | const video = options.videoId |
25 | id: options.videoId, | 25 | ? { |
26 | startAt: options.startAt, | 26 | id: options.videoId, |
27 | endAt: options.endAt | 27 | startAt: options.startAt, |
28 | } : undefined | 28 | endAt: options.endAt |
29 | 29 | } | |
30 | const comment = options.commentId ? { | 30 | : undefined |
31 | id: options.commentId | 31 | |
32 | } : undefined | 32 | const comment = options.commentId |
33 | 33 | ? { id: options.commentId } | |
34 | const account = options.accountId ? { | 34 | : undefined |
35 | id: options.accountId | 35 | |
36 | } : undefined | 36 | const account = options.accountId |
37 | ? { id: options.accountId } | ||
38 | : undefined | ||
37 | 39 | ||
38 | const body = { | 40 | const body = { |
39 | account, | 41 | account, |
diff --git a/shared/extra-utils/plugins/mock-blocklist.ts b/shared/extra-utils/plugins/mock-blocklist.ts index 07c8c5122..50e2289f1 100644 --- a/shared/extra-utils/plugins/mock-blocklist.ts +++ b/shared/extra-utils/plugins/mock-blocklist.ts | |||
@@ -14,7 +14,7 @@ export class MockBlocklist { | |||
14 | private server: Server | 14 | private server: Server |
15 | 15 | ||
16 | initialize () { | 16 | initialize () { |
17 | return new Promise(res => { | 17 | return new Promise<void>(res => { |
18 | const app = express() | 18 | const app = express() |
19 | 19 | ||
20 | app.get('/blocklist', (req: express.Request, res: express.Response) => { | 20 | app.get('/blocklist', (req: express.Request, res: express.Response) => { |
diff --git a/shared/extra-utils/videos/live.ts b/shared/extra-utils/videos/live.ts index 98f67a9bb..b0e499ce0 100644 --- a/shared/extra-utils/videos/live.ts +++ b/shared/extra-utils/videos/live.ts | |||
@@ -98,7 +98,7 @@ function sendRTMPStream (rtmpBaseUrl: string, streamKey: string, fixtureName = ' | |||
98 | } | 98 | } |
99 | 99 | ||
100 | function waitFfmpegUntilError (command: ffmpeg.FfmpegCommand, successAfterMS = 10000) { | 100 | function waitFfmpegUntilError (command: ffmpeg.FfmpegCommand, successAfterMS = 10000) { |
101 | return new Promise((res, rej) => { | 101 | return new Promise<void>((res, rej) => { |
102 | command.on('error', err => { | 102 | command.on('error', err => { |
103 | return rej(err) | 103 | return rej(err) |
104 | }) | 104 | }) |