]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - server/tests/api/check-params/accounts.ts
Move fixtures in tests/
[github/Chocobozzz/PeerTube.git] / server / tests / api / check-params / accounts.ts
CommitLineData
265ba139
C
1/* tslint:disable:no-unused-expression */
2
3import 'mocha'
4
5import { flushTests, killallServers, runServer, ServerInfo } from '../../utils'
6import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '../../utils/requests/check-api-params'
7import { getAccount } from '../../utils/users/accounts'
8
9describe('Test users API validators', function () {
10 const path = '/api/v1/accounts/'
11 let server: ServerInfo
12
13 // ---------------------------------------------------------------
14
15 before(async function () {
e212f887 16 this.timeout(30000)
265ba139
C
17
18 await flushTests()
19
20 server = await runServer(1)
21 })
22
23 describe('When listing accounts', function () {
24 it('Should fail with a bad start pagination', async function () {
25 await checkBadStartPagination(server.url, path, server.accessToken)
26 })
27
28 it('Should fail with a bad count pagination', async function () {
29 await checkBadCountPagination(server.url, path, server.accessToken)
30 })
31
32 it('Should fail with an incorrect sort', async function () {
33 await checkBadSortPagination(server.url, path, server.accessToken)
34 })
35 })
36
37 describe('When getting an account', function () {
ad9e39fb
C
38 it('Should return 404 with a non existing name', async function () {
39 await getAccount(server.url, 'arfaze', 404)
265ba139
C
40 })
41 })
42
43 after(async function () {
44 killallServers([ server ])
45
46 // Keep the logs if the test failed
47 if (this['ok']) {
48 await flushTests()
49 }
50 })
51})