X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Ftests%2Fapi%2Fmoderation%2Fblocklist.ts;h=27592e8c5723079a0fd7b697742789dde35c394c;hb=863477173efa82a4412d2e522aa46462249f9199;hp=b3fd8ecac8cfcf0894e32ff2a24a36bd88886c62;hpb=636d73c58866ed235c207719e41fdde3c2d6c969;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/tests/api/moderation/blocklist.ts b/server/tests/api/moderation/blocklist.ts index b3fd8ecac..27592e8c5 100644 --- a/server/tests/api/moderation/blocklist.ts +++ b/server/tests/api/moderation/blocklist.ts @@ -1,7 +1,7 @@ /* 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, cleanupTests, @@ -10,11 +10,9 @@ import { doubleFollow, PeerTubeServer, setAccessTokensToServers, + setDefaultAccountAvatar, waitJobs -} from '@shared/extra-utils' -import { UserNotificationType } from '@shared/models' - -const expect = chai.expect +} from '@shared/server-commands' async function checkAllVideos (server: PeerTubeServer, token: string) { { @@ -79,6 +77,7 @@ describe('Test blocklist', function () { servers = await createMultipleServers(3) await setAccessTokensToServers(servers) + await setDefaultAccountAvatar(servers) command = servers[0].blocklist commentsCommand = servers.map(s => s.comments) @@ -254,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 @@ -473,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' @@ -643,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 @@ -803,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'