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)
.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/)
searchVideo,
advancedVideosSearch,
searchVideoWithToken,
- searchVideoWithPagination,
searchVideoWithSort
}