1
0
Fork 0
peertube/shared/extra-utils/requests/check-api-params.ts
Chocobozzz 94565d52bb
Shared utils -> extra-utils
Because they need dev dependencies
2019-04-24 16:25:52 +02:00

40 lines
976 B
TypeScript

import { makeGetRequest } from './requests'
import { immutableAssign } from '../miscs/miscs'
function checkBadStartPagination (url: string, path: string, token?: string, query = {}) {
return makeGetRequest({
url,
path,
token,
query: immutableAssign(query, { start: 'hello' }),
statusCodeExpected: 400
})
}
function checkBadCountPagination (url: string, path: string, token?: string, query = {}) {
return makeGetRequest({
url,
path,
token,
query: immutableAssign(query, { count: 'hello' }),
statusCodeExpected: 400
})
}
function checkBadSortPagination (url: string, path: string, token?: string, query = {}) {
return makeGetRequest({
url,
path,
token,
query: immutableAssign(query, { sort: 'hello' }),
statusCodeExpected: 400
})
}
// ---------------------------------------------------------------------------
export {
checkBadStartPagination,
checkBadCountPagination,
checkBadSortPagination
}