]>
Commit | Line | Data |
---|---|---|
1 | /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ | |
2 | ||
3 | import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '@server/tests/shared' | |
4 | import { HttpStatusCode } from '@shared/models' | |
5 | import { cleanupTests, createSingleServer, PeerTubeServer } from '@shared/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 | }) |