1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-05 19:42:24 +02:00

Move test functions outside extra-utils

This commit is contained in:
Chocobozzz 2021-12-17 11:58:15 +01:00
parent bf54587a3e
commit c55e3d7227
No known key found for this signature in database
GPG key ID: 583A612D890159BE
202 changed files with 798 additions and 895 deletions

View file

@ -1,48 +0,0 @@
import { HttpStatusCode } from '@shared/models'
import { makeGetRequest } from './requests'
function checkBadStartPagination (url: string, path: string, token?: string, query = {}) {
return makeGetRequest({
url,
path,
token,
query: { ...query, start: 'hello' },
expectedStatus: HttpStatusCode.BAD_REQUEST_400
})
}
async function checkBadCountPagination (url: string, path: string, token?: string, query = {}) {
await makeGetRequest({
url,
path,
token,
query: { ...query, count: 'hello' },
expectedStatus: HttpStatusCode.BAD_REQUEST_400
})
await makeGetRequest({
url,
path,
token,
query: { ...query, count: 2000 },
expectedStatus: HttpStatusCode.BAD_REQUEST_400
})
}
function checkBadSortPagination (url: string, path: string, token?: string, query = {}) {
return makeGetRequest({
url,
path,
token,
query: { ...query, sort: 'hello' },
expectedStatus: HttpStatusCode.BAD_REQUEST_400
})
}
// ---------------------------------------------------------------------------
export {
checkBadStartPagination,
checkBadCountPagination,
checkBadSortPagination
}

View file

@ -1,3 +1 @@
// Don't include activitypub that import stuff from server
export * from './check-api-params'
export * from './requests'

View file

@ -3,8 +3,8 @@
import { decode } from 'querystring'
import request from 'supertest'
import { URL } from 'url'
import { buildAbsoluteFixturePath } from '@shared/core-utils'
import { HttpStatusCode } from '@shared/models'
import { buildAbsoluteFixturePath } from '../miscs/tests'
export type CommonRequestParams = {
url: string