]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - shared/extra-utils/plugins/mock-blocklist.ts
add examples and descriptions, missing filters for abuses in openapi spec
[github/Chocobozzz/PeerTube.git] / shared / extra-utils / plugins / mock-blocklist.ts
CommitLineData
8bff1fe0
C
1import * as express from 'express'
2
3type BlocklistResponse = {
4 data: {
5 value: string
6 action?: 'add' | 'remove'
91b8e675 7 updatedAt?: string
8bff1fe0
C
8 }[]
9}
10
11export class MockBlocklist {
12 private body: BlocklistResponse
13
14 initialize () {
15 return new Promise(res => {
16 const app = express()
17
18 app.get('/blocklist', (req: express.Request, res: express.Response) => {
19 return res.json(this.body)
20 })
21
22 app.listen(42100, () => res())
23 })
24 }
25
26 replace (body: BlocklistResponse) {
27 this.body = body
28 }
29}