2021-07-16 03:42:24 -05:00
|
|
|
import { HttpStatusCode } from '@shared/models'
|
2017-12-28 07:29:57 -06:00
|
|
|
import { makeGetRequest } from './requests'
|
|
|
|
|
2018-07-20 07:35:18 -05:00
|
|
|
function checkBadStartPagination (url: string, path: string, token?: string, query = {}) {
|
2017-12-28 07:29:57 -06:00
|
|
|
return makeGetRequest({
|
|
|
|
url,
|
|
|
|
path,
|
2017-12-28 07:40:11 -06:00
|
|
|
token,
|
2021-07-13 02:43:59 -05:00
|
|
|
query: { ...query, start: 'hello' },
|
2021-07-16 03:42:24 -05:00
|
|
|
expectedStatus: HttpStatusCode.BAD_REQUEST_400
|
2017-12-28 07:29:57 -06:00
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2020-01-09 02:36:31 -06:00
|
|
|
async function checkBadCountPagination (url: string, path: string, token?: string, query = {}) {
|
|
|
|
await makeGetRequest({
|
2017-12-28 07:29:57 -06:00
|
|
|
url,
|
|
|
|
path,
|
2017-12-28 07:40:11 -06:00
|
|
|
token,
|
2021-07-13 02:43:59 -05:00
|
|
|
query: { ...query, count: 'hello' },
|
2021-07-16 03:42:24 -05:00
|
|
|
expectedStatus: HttpStatusCode.BAD_REQUEST_400
|
2017-12-28 07:29:57 -06:00
|
|
|
})
|
2020-01-09 02:36:31 -06:00
|
|
|
|
|
|
|
await makeGetRequest({
|
|
|
|
url,
|
|
|
|
path,
|
|
|
|
token,
|
2021-07-13 02:43:59 -05:00
|
|
|
query: { ...query, count: 2000 },
|
2021-07-16 03:42:24 -05:00
|
|
|
expectedStatus: HttpStatusCode.BAD_REQUEST_400
|
2020-01-09 02:36:31 -06:00
|
|
|
})
|
2017-12-28 07:29:57 -06:00
|
|
|
}
|
|
|
|
|
2018-07-20 07:35:18 -05:00
|
|
|
function checkBadSortPagination (url: string, path: string, token?: string, query = {}) {
|
2017-12-28 07:29:57 -06:00
|
|
|
return makeGetRequest({
|
|
|
|
url,
|
|
|
|
path,
|
2017-12-28 07:40:11 -06:00
|
|
|
token,
|
2021-07-13 02:43:59 -05:00
|
|
|
query: { ...query, sort: 'hello' },
|
2021-07-16 03:42:24 -05:00
|
|
|
expectedStatus: HttpStatusCode.BAD_REQUEST_400
|
2017-12-28 07:29:57 -06:00
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
export {
|
|
|
|
checkBadStartPagination,
|
|
|
|
checkBadCountPagination,
|
|
|
|
checkBadSortPagination
|
|
|
|
}
|