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