import * as express from 'express'
+import { Server } from 'http'
type BlocklistResponse = {
data: {
export class MockBlocklist {
private body: BlocklistResponse
+ private server: Server
initialize () {
return new Promise(res => {
return res.json(this.body)
})
- app.listen(42100, () => res())
+ this.server = app.listen(42100, () => res())
})
}
replace (body: BlocklistResponse) {
this.body = body
}
+
+ terminate () {
+ if (this.server) this.server.close()
+ }
}