aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--server/tests/external-plugins/auto-block-videos.ts2
-rw-r--r--server/tests/external-plugins/auto-mute.ts2
-rw-r--r--shared/extra-utils/plugins/mock-blocklist.ts8
3 files changed, 11 insertions, 1 deletions
diff --git a/server/tests/external-plugins/auto-block-videos.ts b/server/tests/external-plugins/auto-block-videos.ts
index 3ec03d558..1b91d141e 100644
--- a/server/tests/external-plugins/auto-block-videos.ts
+++ b/server/tests/external-plugins/auto-block-videos.ts
@@ -185,6 +185,8 @@ describe('Official plugin auto-block videos', function () {
185 }) 185 })
186 186
187 after(async function () { 187 after(async function () {
188 await blocklistServer.terminate()
189
188 await cleanupTests(servers) 190 await cleanupTests(servers)
189 }) 191 })
190}) 192})
diff --git a/server/tests/external-plugins/auto-mute.ts b/server/tests/external-plugins/auto-mute.ts
index bfdbee80a..8ead34a2b 100644
--- a/server/tests/external-plugins/auto-mute.ts
+++ b/server/tests/external-plugins/auto-mute.ts
@@ -238,6 +238,8 @@ describe('Official plugin auto-mute', function () {
238 }) 238 })
239 239
240 after(async function () { 240 after(async function () {
241 await blocklistServer.terminate()
242
241 await cleanupTests(servers) 243 await cleanupTests(servers)
242 }) 244 })
243}) 245})
diff --git a/shared/extra-utils/plugins/mock-blocklist.ts b/shared/extra-utils/plugins/mock-blocklist.ts
index 6fe3dee9f..07c8c5122 100644
--- a/shared/extra-utils/plugins/mock-blocklist.ts
+++ b/shared/extra-utils/plugins/mock-blocklist.ts
@@ -1,4 +1,5 @@
1import * as express from 'express' 1import * as express from 'express'
2import { Server } from 'http'
2 3
3type BlocklistResponse = { 4type BlocklistResponse = {
4 data: { 5 data: {
@@ -10,6 +11,7 @@ type BlocklistResponse = {
10 11
11export class MockBlocklist { 12export class MockBlocklist {
12 private body: BlocklistResponse 13 private body: BlocklistResponse
14 private server: Server
13 15
14 initialize () { 16 initialize () {
15 return new Promise(res => { 17 return new Promise(res => {
@@ -19,11 +21,15 @@ export class MockBlocklist {
19 return res.json(this.body) 21 return res.json(this.body)
20 }) 22 })
21 23
22 app.listen(42100, () => res()) 24 this.server = app.listen(42100, () => res())
23 }) 25 })
24 } 26 }
25 27
26 replace (body: BlocklistResponse) { 28 replace (body: BlocklistResponse) {
27 this.body = body 29 this.body = body
28 } 30 }
31
32 terminate () {
33 if (this.server) this.server.close()
34 }
29} 35}