1 /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
3 import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '@server/tests/shared'
4 import { HttpStatusCode } from '@shared/models'
5 import { cleanupTests, createSingleServer, PeerTubeServer } from '@shared/server-commands'
7 describe('Test accounts API validators', function () {
8 const path = '/api/v1/accounts/'
9 let server: PeerTubeServer
11 // ---------------------------------------------------------------
13 before(async function () {
16 server = await createSingleServer(1)
19 describe('When listing accounts', function () {
20 it('Should fail with a bad start pagination', async function () {
21 await checkBadStartPagination(server.url, path, server.accessToken)
24 it('Should fail with a bad count pagination', async function () {
25 await checkBadCountPagination(server.url, path, server.accessToken)
28 it('Should fail with an incorrect sort', async function () {
29 await checkBadSortPagination(server.url, path, server.accessToken)
33 describe('When getting an account', function () {
35 it('Should return 404 with a non existing name', async function () {
36 await server.accounts.get({ accountName: 'arfaze', expectedStatus: HttpStatusCode.NOT_FOUND_404 })
40 after(async function () {
41 await cleanupTests([ server ])