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