diff options
Diffstat (limited to 'shared')
-rw-r--r-- | shared/extra-utils/plugins/mock-blocklist.ts | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/shared/extra-utils/plugins/mock-blocklist.ts b/shared/extra-utils/plugins/mock-blocklist.ts index 50e2289f1..d18f8224f 100644 --- a/shared/extra-utils/plugins/mock-blocklist.ts +++ b/shared/extra-utils/plugins/mock-blocklist.ts | |||
@@ -1,5 +1,6 @@ | |||
1 | import * as express from 'express' | 1 | import * as express from 'express' |
2 | import { Server } from 'http' | 2 | import { Server } from 'http' |
3 | import { randomInt } from '@shared/core-utils' | ||
3 | 4 | ||
4 | type BlocklistResponse = { | 5 | type BlocklistResponse = { |
5 | data: { | 6 | data: { |
@@ -14,14 +15,15 @@ export class MockBlocklist { | |||
14 | private server: Server | 15 | private server: Server |
15 | 16 | ||
16 | initialize () { | 17 | initialize () { |
17 | return new Promise<void>(res => { | 18 | return new Promise<number>(res => { |
18 | const app = express() | 19 | const app = express() |
19 | 20 | ||
20 | app.get('/blocklist', (req: express.Request, res: express.Response) => { | 21 | app.get('/blocklist', (req: express.Request, res: express.Response) => { |
21 | return res.json(this.body) | 22 | return res.json(this.body) |
22 | }) | 23 | }) |
23 | 24 | ||
24 | this.server = app.listen(42100, () => res()) | 25 | const port = 42201 + randomInt(1, 100) |
26 | this.server = app.listen(port, () => res(port)) | ||
25 | }) | 27 | }) |
26 | } | 28 | } |
27 | 29 | ||