From 9639bd175726b73f8fe664b5ced12a72407b1f0b Mon Sep 17 00:00:00 2001 From: buoyantair Date: Mon, 29 Oct 2018 22:18:31 +0530 Subject: Move utils to /shared Move utils used by /server/tools/* & /server/tests/**/* into /shared folder. Issue: #1336 --- server/tests/utils/search/video-channels.ts | 22 --------- server/tests/utils/search/videos.ts | 77 ----------------------------- 2 files changed, 99 deletions(-) delete mode 100644 server/tests/utils/search/video-channels.ts delete mode 100644 server/tests/utils/search/videos.ts (limited to 'server/tests/utils/search') diff --git a/server/tests/utils/search/video-channels.ts b/server/tests/utils/search/video-channels.ts deleted file mode 100644 index 0532134ae..000000000 --- a/server/tests/utils/search/video-channels.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { makeGetRequest } from '../requests/requests' - -function searchVideoChannel (url: string, search: string, token?: string, statusCodeExpected = 200) { - const path = '/api/v1/search/video-channels' - - return makeGetRequest({ - url, - path, - query: { - sort: '-createdAt', - search - }, - token, - statusCodeExpected - }) -} - -// --------------------------------------------------------------------------- - -export { - searchVideoChannel -} diff --git a/server/tests/utils/search/videos.ts b/server/tests/utils/search/videos.ts deleted file mode 100644 index 3a0c10e42..000000000 --- a/server/tests/utils/search/videos.ts +++ /dev/null @@ -1,77 +0,0 @@ -/* tslint:disable:no-unused-expression */ - -import * as request from 'supertest' -import { VideosSearchQuery } from '../../../../shared/models/search' -import { immutableAssign } from '..' - -function searchVideo (url: string, search: string) { - const path = '/api/v1/search/videos' - const req = request(url) - .get(path) - .query({ sort: '-publishedAt', search }) - .set('Accept', 'application/json') - - return req.expect(200) - .expect('Content-Type', /json/) -} - -function searchVideoWithToken (url: string, search: string, token: string, query: { nsfw?: boolean } = {}) { - const path = '/api/v1/search/videos' - const req = request(url) - .get(path) - .set('Authorization', 'Bearer ' + token) - .query(immutableAssign(query, { sort: '-publishedAt', search })) - .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' - - return request(url) - .get(path) - .query({ search }) - .query({ sort }) - .set('Accept', 'application/json') - .expect(200) - .expect('Content-Type', /json/) -} - -function advancedVideosSearch (url: string, options: VideosSearchQuery) { - const path = '/api/v1/search/videos' - - return request(url) - .get(path) - .query(options) - .set('Accept', 'application/json') - .expect(200) - .expect('Content-Type', /json/) -} - -// --------------------------------------------------------------------------- - -export { - searchVideo, - advancedVideosSearch, - searchVideoWithToken, - searchVideoWithPagination, - searchVideoWithSort -} -- cgit v1.2.3