diff options
Diffstat (limited to 'shared/extra-utils/requests/check-api-params.ts')
-rw-r--r-- | shared/extra-utils/requests/check-api-params.ts | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/shared/extra-utils/requests/check-api-params.ts b/shared/extra-utils/requests/check-api-params.ts index 7f5ff775c..26ba1e913 100644 --- a/shared/extra-utils/requests/check-api-params.ts +++ b/shared/extra-utils/requests/check-api-params.ts | |||
@@ -1,14 +1,13 @@ | |||
1 | import { HttpStatusCode } from '@shared/models' | ||
1 | import { makeGetRequest } from './requests' | 2 | import { makeGetRequest } from './requests' |
2 | import { immutableAssign } from '../miscs/miscs' | ||
3 | import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes' | ||
4 | 3 | ||
5 | function checkBadStartPagination (url: string, path: string, token?: string, query = {}) { | 4 | function checkBadStartPagination (url: string, path: string, token?: string, query = {}) { |
6 | return makeGetRequest({ | 5 | return makeGetRequest({ |
7 | url, | 6 | url, |
8 | path, | 7 | path, |
9 | token, | 8 | token, |
10 | query: immutableAssign(query, { start: 'hello' }), | 9 | query: { ...query, start: 'hello' }, |
11 | statusCodeExpected: HttpStatusCode.BAD_REQUEST_400 | 10 | expectedStatus: HttpStatusCode.BAD_REQUEST_400 |
12 | }) | 11 | }) |
13 | } | 12 | } |
14 | 13 | ||
@@ -17,16 +16,16 @@ async function checkBadCountPagination (url: string, path: string, token?: strin | |||
17 | url, | 16 | url, |
18 | path, | 17 | path, |
19 | token, | 18 | token, |
20 | query: immutableAssign(query, { count: 'hello' }), | 19 | query: { ...query, count: 'hello' }, |
21 | statusCodeExpected: HttpStatusCode.BAD_REQUEST_400 | 20 | expectedStatus: HttpStatusCode.BAD_REQUEST_400 |
22 | }) | 21 | }) |
23 | 22 | ||
24 | await makeGetRequest({ | 23 | await makeGetRequest({ |
25 | url, | 24 | url, |
26 | path, | 25 | path, |
27 | token, | 26 | token, |
28 | query: immutableAssign(query, { count: 2000 }), | 27 | query: { ...query, count: 2000 }, |
29 | statusCodeExpected: HttpStatusCode.BAD_REQUEST_400 | 28 | expectedStatus: HttpStatusCode.BAD_REQUEST_400 |
30 | }) | 29 | }) |
31 | } | 30 | } |
32 | 31 | ||
@@ -35,8 +34,8 @@ function checkBadSortPagination (url: string, path: string, token?: string, quer | |||
35 | url, | 34 | url, |
36 | path, | 35 | path, |
37 | token, | 36 | token, |
38 | query: immutableAssign(query, { sort: 'hello' }), | 37 | query: { ...query, sort: 'hello' }, |
39 | statusCodeExpected: HttpStatusCode.BAD_REQUEST_400 | 38 | expectedStatus: HttpStatusCode.BAD_REQUEST_400 |
40 | }) | 39 | }) |
41 | } | 40 | } |
42 | 41 | ||