]>
Commit | Line | Data |
---|---|---|
8bff1fe0 C |
1 | import * as express from 'express' |
2 | ||
3 | type BlocklistResponse = { | |
4 | data: { | |
5 | value: string | |
6 | action?: 'add' | 'remove' | |
7 | }[] | |
8 | } | |
9 | ||
10 | export class MockBlocklist { | |
11 | private body: BlocklistResponse | |
12 | ||
13 | initialize () { | |
14 | return new Promise(res => { | |
15 | const app = express() | |
16 | ||
17 | app.get('/blocklist', (req: express.Request, res: express.Response) => { | |
18 | return res.json(this.body) | |
19 | }) | |
20 | ||
21 | app.listen(42100, () => res()) | |
22 | }) | |
23 | } | |
24 | ||
25 | replace (body: BlocklistResponse) { | |
26 | this.body = body | |
27 | } | |
28 | } |