]>
Commit | Line | Data |
---|---|---|
1 | /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ | |
2 | ||
3 | import 'mocha' | |
4 | import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '@server/tests/shared' | |
5 | import { HttpStatusCode } from '@shared/models' | |
6 | import { cleanupTests, createSingleServer, PeerTubeServer } from '@shared/server-commands' | |
7 | ||
8 | describe('Test accounts API validators', function () { | |
9 | const path = '/api/v1/accounts/' | |
10 | let server: PeerTubeServer | |
11 | ||
12 | // --------------------------------------------------------------- | |
13 | ||
14 | before(async function () { | |
15 | this.timeout(30000) | |
16 | ||
17 | server = await createSingleServer(1) | |
18 | }) | |
19 | ||
20 | describe('When listing accounts', function () { | |
21 | it('Should fail with a bad start pagination', async function () { | |
22 | await checkBadStartPagination(server.url, path, server.accessToken) | |
23 | }) | |
24 | ||
25 | it('Should fail with a bad count pagination', async function () { | |
26 | await checkBadCountPagination(server.url, path, server.accessToken) | |
27 | }) | |
28 | ||
29 | it('Should fail with an incorrect sort', async function () { | |
30 | await checkBadSortPagination(server.url, path, server.accessToken) | |
31 | }) | |
32 | }) | |
33 | ||
34 | describe('When getting an account', function () { | |
35 | ||
36 | it('Should return 404 with a non existing name', async function () { | |
37 | await server.accounts.get({ accountName: 'arfaze', expectedStatus: HttpStatusCode.NOT_FOUND_404 }) | |
38 | }) | |
39 | }) | |
40 | ||
41 | after(async function () { | |
42 | await cleanupTests([ server ]) | |
43 | }) | |
44 | }) |