]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - shared/extra-utils/search/videos.ts
Merge branch 'release/2.3.0' into develop
[github/Chocobozzz/PeerTube.git] / shared / extra-utils / search / videos.ts
index ba46270175f45edc395deb80a450b38c9f83897a..4c52ea11c48d1739b5946def11b931639d03c622 100644 (file)
@@ -1,4 +1,4 @@
-/* tslint:disable:no-unused-expression */
+/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
 
 import * as request from 'supertest'
 import { VideosSearchQuery } from '../../models/search'
@@ -6,9 +6,11 @@ import { immutableAssign } from '../miscs/miscs'
 
 function searchVideo (url: string, search: string) {
   const path = '/api/v1/search/videos'
+
+  const query = { sort: '-publishedAt', search: search }
   const req = request(url)
     .get(path)
-    .query({ sort: '-publishedAt', search })
+    .query(query)
     .set('Accept', 'application/json')
 
   return req.expect(200)
@@ -27,29 +29,14 @@ function searchVideoWithToken (url: string, search: string, token: string, query
             .expect('Content-Type', /json/)
 }
 
-function searchVideoWithPagination (url: string, search: string, start: number, count: number, sort?: string) {
-  const path = '/api/v1/search/videos'
-
-  const req = request(url)
-    .get(path)
-    .query({ start })
-    .query({ search })
-    .query({ count })
-
-  if (sort) req.query({ sort })
-
-  return req.set('Accept', 'application/json')
-            .expect(200)
-            .expect('Content-Type', /json/)
-}
-
 function searchVideoWithSort (url: string, search: string, sort: string) {
   const path = '/api/v1/search/videos'
 
+  const query = { search, sort }
+
   return request(url)
     .get(path)
-    .query({ search })
-    .query({ sort })
+    .query(query)
     .set('Accept', 'application/json')
     .expect(200)
     .expect('Content-Type', /json/)
@@ -72,6 +59,5 @@ export {
   searchVideo,
   advancedVideosSearch,
   searchVideoWithToken,
-  searchVideoWithPagination,
   searchVideoWithSort
 }