]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - server/tests/api/check-params/accounts.ts
Add filter by start/end date overall stats in api
[github/Chocobozzz/PeerTube.git] / server / tests / api / check-params / accounts.ts
CommitLineData
a1587156 1/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
265ba139
C
2
3import 'mocha'
c55e3d72 4import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '@server/tests/shared'
4c7e60bc 5import { HttpStatusCode } from '@shared/models'
c55e3d72 6import { cleanupTests, createSingleServer, PeerTubeServer } from '@shared/server-commands'
265ba139 7
926cd3df 8describe('Test accounts API validators', function () {
265ba139 9 const path = '/api/v1/accounts/'
254d3579 10 let server: PeerTubeServer
265ba139
C
11
12 // ---------------------------------------------------------------
13
14 before(async function () {
e212f887 15 this.timeout(30000)
265ba139 16
254d3579 17 server = await createSingleServer(1)
265ba139
C
18 })
19
20 describe('When listing accounts', function () {
21 it('Should fail with a bad start pagination', async function () {
22 await checkBadStartPagination(server.url, path, server.accessToken)
23 })
24
25 it('Should fail with a bad count pagination', async function () {
26 await checkBadCountPagination(server.url, path, server.accessToken)
27 })
28
29 it('Should fail with an incorrect sort', async function () {
30 await checkBadSortPagination(server.url, path, server.accessToken)
31 })
32 })
33
34 describe('When getting an account', function () {
9fff08cf 35
ad9e39fb 36 it('Should return 404 with a non existing name', async function () {
89d241a7 37 await server.accounts.get({ accountName: 'arfaze', expectedStatus: HttpStatusCode.NOT_FOUND_404 })
265ba139
C
38 })
39 })
40
86ebdf8c
C
41 after(async function () {
42 await cleanupTests([ server ])
265ba139
C
43 })
44})