aboutsummaryrefslogtreecommitdiffhomepage
path: root/shared/extra-utils/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'shared/extra-utils/plugins')
-rw-r--r--shared/extra-utils/plugins/mock-blocklist.ts37
1 files changed, 0 insertions, 37 deletions
diff --git a/shared/extra-utils/plugins/mock-blocklist.ts b/shared/extra-utils/plugins/mock-blocklist.ts
deleted file mode 100644
index d18f8224f..000000000
--- a/shared/extra-utils/plugins/mock-blocklist.ts
+++ /dev/null
@@ -1,37 +0,0 @@
1import * as express from 'express'
2import { Server } from 'http'
3import { randomInt } from '@shared/core-utils'
4
5type BlocklistResponse = {
6 data: {
7 value: string
8 action?: 'add' | 'remove'
9 updatedAt?: string
10 }[]
11}
12
13export class MockBlocklist {
14 private body: BlocklistResponse
15 private server: Server
16
17 initialize () {
18 return new Promise<number>(res => {
19 const app = express()
20
21 app.get('/blocklist', (req: express.Request, res: express.Response) => {
22 return res.json(this.body)
23 })
24
25 const port = 42201 + randomInt(1, 100)
26 this.server = app.listen(port, () => res(port))
27 })
28 }
29
30 replace (body: BlocklistResponse) {
31 this.body = body
32 }
33
34 terminate () {
35 if (this.server) this.server.close()
36 }
37}