From 480d6ea6791fe4100f1905af1e1e3a08173594ea Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 6 Jul 2021 14:07:54 +0200 Subject: Move plugin blocklist mock --- shared/extra-utils/plugins/mock-blocklist.ts | 37 ---------------------------- 1 file changed, 37 deletions(-) delete mode 100644 shared/extra-utils/plugins/mock-blocklist.ts (limited to 'shared/extra-utils/plugins') diff --git a/shared/extra-utils/plugins/mock-blocklist.ts b/shared/extra-utils/plugins/mock-blocklist.ts deleted file mode 100644 index d18f8224f..000000000 --- a/shared/extra-utils/plugins/mock-blocklist.ts +++ /dev/null @@ -1,37 +0,0 @@ -import * as express from 'express' -import { Server } from 'http' -import { randomInt } from '@shared/core-utils' - -type BlocklistResponse = { - data: { - value: string - action?: 'add' | 'remove' - updatedAt?: string - }[] -} - -export class MockBlocklist { - private body: BlocklistResponse - private server: Server - - initialize () { - return new Promise(res => { - const app = express() - - app.get('/blocklist', (req: express.Request, res: express.Response) => { - return res.json(this.body) - }) - - const port = 42201 + randomInt(1, 100) - this.server = app.listen(port, () => res(port)) - }) - } - - replace (body: BlocklistResponse) { - this.body = body - } - - terminate () { - if (this.server) this.server.close() - } -} -- cgit v1.2.3