1
0
Fork 0
peertube/shared/utils/requests/check-api-params.ts
buoyantair 9639bd1757 Move utils to /shared
Move utils used by /server/tools/* & /server/tests/**/* into
/shared folder.

Issue: #1336
2018-10-29 22:18:31 +05:30

40 lines
964 B
TypeScript

import { makeGetRequest } from './requests'
import { immutableAssign } from '..'
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
}