]>
Commit | Line | Data |
---|---|---|
a1587156 | 1 | /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ |
265ba139 C |
2 | |
3 | import 'mocha' | |
4 | ||
86ebdf8c | 5 | import { cleanupTests, flushAndRunServer, ServerInfo } from '../../../../shared/extra-utils' |
9639bd17 | 6 | import { |
7 | checkBadCountPagination, | |
8 | checkBadSortPagination, | |
9 | checkBadStartPagination | |
94565d52 C |
10 | } from '../../../../shared/extra-utils/requests/check-api-params' |
11 | import { getAccount } from '../../../../shared/extra-utils/users/accounts' | |
f2eb23cd | 12 | import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes' |
265ba139 | 13 | |
926cd3df | 14 | describe('Test accounts API validators', function () { |
265ba139 C |
15 | const path = '/api/v1/accounts/' |
16 | let server: ServerInfo | |
17 | ||
18 | // --------------------------------------------------------------- | |
19 | ||
20 | before(async function () { | |
e212f887 | 21 | this.timeout(30000) |
265ba139 | 22 | |
210feb6c | 23 | server = await flushAndRunServer(1) |
265ba139 C |
24 | }) |
25 | ||
26 | describe('When listing accounts', function () { | |
27 | it('Should fail with a bad start pagination', async function () { | |
28 | await checkBadStartPagination(server.url, path, server.accessToken) | |
29 | }) | |
30 | ||
31 | it('Should fail with a bad count pagination', async function () { | |
32 | await checkBadCountPagination(server.url, path, server.accessToken) | |
33 | }) | |
34 | ||
35 | it('Should fail with an incorrect sort', async function () { | |
36 | await checkBadSortPagination(server.url, path, server.accessToken) | |
37 | }) | |
38 | }) | |
39 | ||
40 | describe('When getting an account', function () { | |
ad9e39fb | 41 | it('Should return 404 with a non existing name', async function () { |
f2eb23cd | 42 | await getAccount(server.url, 'arfaze', HttpStatusCode.NOT_FOUND_404) |
265ba139 C |
43 | }) |
44 | }) | |
45 | ||
86ebdf8c C |
46 | after(async function () { |
47 | await cleanupTests([ server ]) | |
265ba139 C |
48 | }) |
49 | }) |