import 'mocha'
-import { flushTests, immutableAssign, killallServers, makeGetRequest, runServer, ServerInfo } from '../../utils'
-import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '../../utils/requests/check-api-params'
+import { flushTests, immutableAssign, killallServers, makeGetRequest, runServer, ServerInfo } from '../../../../shared/utils'
+import {
+ checkBadCountPagination,
+ checkBadSortPagination,
+ checkBadStartPagination
+} from '../../../../shared/utils/requests/check-api-params'
describe('Test videos API validator', function () {
- const path = '/api/v1/search/videos/'
let server: ServerInfo
// ---------------------------------------------------------------
})
describe('When searching videos', function () {
+ const path = '/api/v1/search/videos/'
+
const query = {
search: 'coucou'
}
})
})
+ describe('When searching video channels', function () {
+ const path = '/api/v1/search/video-channels/'
+
+ const query = {
+ search: 'coucou'
+ }
+
+ it('Should fail with a bad start pagination', async function () {
+ await checkBadStartPagination(server.url, path, null, query)
+ })
+
+ it('Should fail with a bad count pagination', async function () {
+ await checkBadCountPagination(server.url, path, null, query)
+ })
+
+ it('Should fail with an incorrect sort', async function () {
+ await checkBadSortPagination(server.url, path, null, query)
+ })
+
+ it('Should success with the correct parameters', async function () {
+ await makeGetRequest({ url: server.url, path, query, statusCodeExpected: 200 })
+ })
+ })
+
after(async function () {
killallServers([ server ])