mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-10-04 02:09:37 +02:00
Add auto mute plugin tests
This commit is contained in:
parent
faf174d043
commit
8bff1fe009
4 changed files with 150 additions and 0 deletions
28
shared/extra-utils/plugins/mock-blocklist.ts
Normal file
28
shared/extra-utils/plugins/mock-blocklist.ts
Normal file
|
@ -0,0 +1,28 @@
|
|||
import * as express from 'express'
|
||||
|
||||
type BlocklistResponse = {
|
||||
data: {
|
||||
value: string
|
||||
action?: 'add' | 'remove'
|
||||
}[]
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue