1 /* tslint:disable:no-unused-expression */
5 import { flushTests, killallServers, runServer, ServerInfo } from '../../utils'
6 import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '../../utils/requests/check-api-params'
7 import { getAccount } from '../../utils/users/accounts'
9 describe('Test users API validators', function () {
10 const path = '/api/v1/accounts/'
11 let server: ServerInfo
13 // ---------------------------------------------------------------
15 before(async function () {
20 server = await runServer(1)
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)
28 it('Should fail with a bad count pagination', async function () {
29 await checkBadCountPagination(server.url, path, server.accessToken)
32 it('Should fail with an incorrect sort', async function () {
33 await checkBadSortPagination(server.url, path, server.accessToken)
37 describe('When getting an account', function () {
38 it('Should return 404 with a non existing name', async function () {
39 await getAccount(server.url, 'arfaze', 404)
43 after(async function () {
44 killallServers([ server ])
46 // Keep the logs if the test failed