2017-12-28 14:29:57 +01:00
|
|
|
import { makeGetRequest } from './requests'
|
2018-11-19 17:08:18 +01:00
|
|
|
import { immutableAssign } from '../miscs/miscs'
|
2020-12-07 14:32:36 +01:00
|
|
|
import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes'
|
2017-12-28 14:29:57 +01:00
|
|
|
|
2018-07-20 14:35:18 +02:00
|
|
|
function checkBadStartPagination (url: string, path: string, token?: string, query = {}) {
|
2017-12-28 14:29:57 +01:00
|
|
|
return makeGetRequest({
|
|
|
|
url,
|
|
|
|
path,
|
2017-12-28 14:40:11 +01:00
|
|
|
token,
|
2018-07-20 14:35:18 +02:00
|
|
|
query: immutableAssign(query, { start: 'hello' }),
|
2020-12-07 14:32:36 +01:00
|
|
|
statusCodeExpected: HttpStatusCode.BAD_REQUEST_400
|
2017-12-28 14:29:57 +01:00
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2020-01-09 09:36:31 +01:00
|
|
|
async function checkBadCountPagination (url: string, path: string, token?: string, query = {}) {
|
|
|
|
await makeGetRequest({
|
2017-12-28 14:29:57 +01:00
|
|
|
url,
|
|
|
|
path,
|
2017-12-28 14:40:11 +01:00
|
|
|
token,
|
2018-07-20 14:35:18 +02:00
|
|
|
query: immutableAssign(query, { count: 'hello' }),
|
2020-12-07 14:32:36 +01:00
|
|
|
statusCodeExpected: HttpStatusCode.BAD_REQUEST_400
|
2017-12-28 14:29:57 +01:00
|
|
|
})
|
2020-01-09 09:36:31 +01:00
|
|
|
|
|
|
|
await makeGetRequest({
|
|
|
|
url,
|
|
|
|
path,
|
|
|
|
token,
|
|
|
|
query: immutableAssign(query, { count: 2000 }),
|
2020-12-07 14:32:36 +01:00
|
|
|
statusCodeExpected: HttpStatusCode.BAD_REQUEST_400
|
2020-01-09 09:36:31 +01:00
|
|
|
})
|
2017-12-28 14:29:57 +01:00
|
|
|
}
|
|
|
|
|
2018-07-20 14:35:18 +02:00
|
|
|
function checkBadSortPagination (url: string, path: string, token?: string, query = {}) {
|
2017-12-28 14:29:57 +01:00
|
|
|
return makeGetRequest({
|
|
|
|
url,
|
|
|
|
path,
|
2017-12-28 14:40:11 +01:00
|
|
|
token,
|
2018-07-20 14:35:18 +02:00
|
|
|
query: immutableAssign(query, { sort: 'hello' }),
|
2020-12-07 14:32:36 +01:00
|
|
|
statusCodeExpected: HttpStatusCode.BAD_REQUEST_400
|
2017-12-28 14:29:57 +01:00
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
export {
|
|
|
|
checkBadStartPagination,
|
|
|
|
checkBadCountPagination,
|
|
|
|
checkBadSortPagination
|
|
|
|
}
|