]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blob - shared/extra-utils/requests/check-api-params.ts
Support logout and add id and pass tests
[github/Chocobozzz/PeerTube.git] / shared / extra-utils / requests / check-api-params.ts
1 import { makeGetRequest } from './requests'
2 import { immutableAssign } from '../miscs/miscs'
3
4 function checkBadStartPagination (url: string, path: string, token?: string, query = {}) {
5 return makeGetRequest({
6 url,
7 path,
8 token,
9 query: immutableAssign(query, { start: 'hello' }),
10 statusCodeExpected: 400
11 })
12 }
13
14 async function checkBadCountPagination (url: string, path: string, token?: string, query = {}) {
15 await makeGetRequest({
16 url,
17 path,
18 token,
19 query: immutableAssign(query, { count: 'hello' }),
20 statusCodeExpected: 400
21 })
22
23 await makeGetRequest({
24 url,
25 path,
26 token,
27 query: immutableAssign(query, { count: 2000 }),
28 statusCodeExpected: 400
29 })
30 }
31
32 function checkBadSortPagination (url: string, path: string, token?: string, query = {}) {
33 return makeGetRequest({
34 url,
35 path,
36 token,
37 query: immutableAssign(query, { sort: 'hello' }),
38 statusCodeExpected: 400
39 })
40 }
41
42 // ---------------------------------------------------------------------------
43
44 export {
45 checkBadStartPagination,
46 checkBadCountPagination,
47 checkBadSortPagination
48 }