diff options
Diffstat (limited to 'packages/tests/src/api/check-params/accounts.ts')
-rw-r--r-- | packages/tests/src/api/check-params/accounts.ts | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/packages/tests/src/api/check-params/accounts.ts b/packages/tests/src/api/check-params/accounts.ts new file mode 100644 index 000000000..87810bbd3 --- /dev/null +++ b/packages/tests/src/api/check-params/accounts.ts | |||
@@ -0,0 +1,43 @@ | |||
1 | /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ | ||
2 | |||
3 | import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '@tests/shared/checks.js' | ||
4 | import { HttpStatusCode } from '@peertube/peertube-models' | ||
5 | import { cleanupTests, createSingleServer, PeerTubeServer } from '@peertube/peertube-server-commands' | ||
6 | |||
7 | describe('Test accounts API validators', function () { | ||
8 | const path = '/api/v1/accounts/' | ||
9 | let server: PeerTubeServer | ||
10 | |||
11 | // --------------------------------------------------------------- | ||
12 | |||
13 | before(async function () { | ||
14 | this.timeout(30000) | ||
15 | |||
16 | server = await createSingleServer(1) | ||
17 | }) | ||
18 | |||
19 | describe('When listing accounts', function () { | ||
20 | it('Should fail with a bad start pagination', async function () { | ||
21 | await checkBadStartPagination(server.url, path, server.accessToken) | ||
22 | }) | ||
23 | |||
24 | it('Should fail with a bad count pagination', async function () { | ||
25 | await checkBadCountPagination(server.url, path, server.accessToken) | ||
26 | }) | ||
27 | |||
28 | it('Should fail with an incorrect sort', async function () { | ||
29 | await checkBadSortPagination(server.url, path, server.accessToken) | ||
30 | }) | ||
31 | }) | ||
32 | |||
33 | describe('When getting an account', function () { | ||
34 | |||
35 | it('Should return 404 with a non existing name', async function () { | ||
36 | await server.accounts.get({ accountName: 'arfaze', expectedStatus: HttpStatusCode.NOT_FOUND_404 }) | ||
37 | }) | ||
38 | }) | ||
39 | |||
40 | after(async function () { | ||
41 | await cleanupTests([ server ]) | ||
42 | }) | ||
43 | }) | ||