aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/check-params/accounts.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/tests/api/check-params/accounts.ts')
-rw-r--r--server/tests/api/check-params/accounts.ts51
1 files changed, 51 insertions, 0 deletions
diff --git a/server/tests/api/check-params/accounts.ts b/server/tests/api/check-params/accounts.ts
new file mode 100644
index 000000000..351228754
--- /dev/null
+++ b/server/tests/api/check-params/accounts.ts
@@ -0,0 +1,51 @@
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 () {
16 this.timeout(20000)
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 () {
38 it('Should return 404 with a non existing id', async function () {
39 await getAccount(server.url, 4545454, 404)
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})