]>
Commit | Line | Data |
---|---|---|
1 | import { makeGetRequest } from './requests' | |
2 | import { immutableAssign } from '../miscs/miscs' | |
3 | import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes' | |
4 | ||
5 | function checkBadStartPagination (url: string, path: string, token?: string, query = {}) { | |
6 | return makeGetRequest({ | |
7 | url, | |
8 | path, | |
9 | token, | |
10 | query: immutableAssign(query, { start: 'hello' }), | |
11 | statusCodeExpected: HttpStatusCode.BAD_REQUEST_400 | |
12 | }) | |
13 | } | |
14 | ||
15 | async function checkBadCountPagination (url: string, path: string, token?: string, query = {}) { | |
16 | await makeGetRequest({ | |
17 | url, | |
18 | path, | |
19 | token, | |
20 | query: immutableAssign(query, { count: 'hello' }), | |
21 | statusCodeExpected: HttpStatusCode.BAD_REQUEST_400 | |
22 | }) | |
23 | ||
24 | await makeGetRequest({ | |
25 | url, | |
26 | path, | |
27 | token, | |
28 | query: immutableAssign(query, { count: 2000 }), | |
29 | statusCodeExpected: HttpStatusCode.BAD_REQUEST_400 | |
30 | }) | |
31 | } | |
32 | ||
33 | function checkBadSortPagination (url: string, path: string, token?: string, query = {}) { | |
34 | return makeGetRequest({ | |
35 | url, | |
36 | path, | |
37 | token, | |
38 | query: immutableAssign(query, { sort: 'hello' }), | |
39 | statusCodeExpected: HttpStatusCode.BAD_REQUEST_400 | |
40 | }) | |
41 | } | |
42 | ||
43 | // --------------------------------------------------------------------------- | |
44 | ||
45 | export { | |
46 | checkBadStartPagination, | |
47 | checkBadCountPagination, | |
48 | checkBadSortPagination | |
49 | } |