]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/tests/api/moderation/blocklist.ts
Cleanup tests imports
[github/Chocobozzz/PeerTube.git] / server / tests / api / moderation / blocklist.ts
index e1344a2452d5ec5167434dcefde431fce0e424ca..27592e8c5723079a0fd7b697742789dde35c394c 100644 (file)
@@ -1,7 +1,6 @@
 /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
 
-import 'mocha'
-import * as chai from 'chai'
+import { expect } from 'chai'
 import { UserNotificationType } from '@shared/models'
 import {
   BlocklistCommand,
@@ -15,8 +14,6 @@ import {
   waitJobs
 } from '@shared/server-commands'
 
-const expect = chai.expect
-
 async function checkAllVideos (server: PeerTubeServer, token: string) {
   {
     const { data } = await server.videos.listWithToken({ token })
@@ -256,6 +253,13 @@ describe('Test blocklist', function () {
         }
       })
 
+      it('Should search blocked accounts', async function () {
+        const body = await command.listMyAccountBlocklist({ start: 0, count: 10, search: 'user2' })
+        expect(body.total).to.equal(1)
+
+        expect(body.data[0].blockedAccount.name).to.equal('user2')
+      })
+
       it('Should get blocked status', async function () {
         const remoteHandle = 'user2@' + servers[1].host
         const localHandle = 'user1@' + servers[0].host
@@ -475,6 +479,13 @@ describe('Test blocklist', function () {
         expect(block.blockedServer.host).to.equal('localhost:' + servers[1].port)
       })
 
+      it('Should search blocked servers', async function () {
+        const body = await command.listMyServerBlocklist({ start: 0, count: 10, search: servers[1].host })
+        expect(body.total).to.equal(1)
+
+        expect(body.data[0].blockedServer.host).to.equal(servers[1].host)
+      })
+
       it('Should get blocklist status', async function () {
         const blockedServer = servers[1].host
         const notBlockedServer = 'example.com'
@@ -645,6 +656,13 @@ describe('Test blocklist', function () {
         }
       })
 
+      it('Should search blocked accounts', async function () {
+        const body = await command.listServerAccountBlocklist({ start: 0, count: 10, search: 'user2' })
+        expect(body.total).to.equal(1)
+
+        expect(body.data[0].blockedAccount.name).to.equal('user2')
+      })
+
       it('Should get blocked status', async function () {
         const remoteHandle = 'user2@' + servers[1].host
         const localHandle = 'user1@' + servers[0].host
@@ -805,6 +823,13 @@ describe('Test blocklist', function () {
         expect(block.blockedServer.host).to.equal('localhost:' + servers[1].port)
       })
 
+      it('Should search blocked servers', async function () {
+        const body = await command.listServerServerBlocklist({ start: 0, count: 10, search: servers[1].host })
+        expect(body.total).to.equal(1)
+
+        expect(body.data[0].blockedServer.host).to.equal(servers[1].host)
+      })
+
       it('Should get blocklist status', async function () {
         const blockedServer = servers[1].host
         const notBlockedServer = 'example.com'