diff options
Diffstat (limited to 'server/tests/utils/search')
-rw-r--r-- | server/tests/utils/search/video-channels.ts | 22 | ||||
-rw-r--r-- | server/tests/utils/search/videos.ts | 77 |
2 files changed, 0 insertions, 99 deletions
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 @@ | |||
1 | import { makeGetRequest } from '../requests/requests' | ||
2 | |||
3 | function searchVideoChannel (url: string, search: string, token?: string, statusCodeExpected = 200) { | ||
4 | const path = '/api/v1/search/video-channels' | ||
5 | |||
6 | return makeGetRequest({ | ||
7 | url, | ||
8 | path, | ||
9 | query: { | ||
10 | sort: '-createdAt', | ||
11 | search | ||
12 | }, | ||
13 | token, | ||
14 | statusCodeExpected | ||
15 | }) | ||
16 | } | ||
17 | |||
18 | // --------------------------------------------------------------------------- | ||
19 | |||
20 | export { | ||
21 | searchVideoChannel | ||
22 | } | ||
diff --git a/server/tests/utils/search/videos.ts b/server/tests/utils/search/videos.ts deleted file mode 100644 index 8c0037ccc..000000000 --- a/server/tests/utils/search/videos.ts +++ /dev/null | |||
@@ -1,77 +0,0 @@ | |||
1 | /* tslint:disable:no-unused-expression */ | ||
2 | |||
3 | import * as request from 'supertest' | ||
4 | import { VideosSearchQuery } from '../../../../shared/models/search' | ||
5 | import { immutableAssign } from '../miscs/miscs' | ||
6 | |||
7 | function searchVideo (url: string, search: string) { | ||
8 | const path = '/api/v1/search/videos' | ||
9 | const req = request(url) | ||
10 | .get(path) | ||
11 | .query({ sort: '-publishedAt', search }) | ||
12 | .set('Accept', 'application/json') | ||
13 | |||
14 | return req.expect(200) | ||
15 | .expect('Content-Type', /json/) | ||
16 | } | ||
17 | |||
18 | function searchVideoWithToken (url: string, search: string, token: string, query: { nsfw?: boolean } = {}) { | ||
19 | const path = '/api/v1/search/videos' | ||
20 | const req = request(url) | ||
21 | .get(path) | ||
22 | .set('Authorization', 'Bearer ' + token) | ||
23 | .query(immutableAssign(query, { sort: '-publishedAt', search })) | ||
24 | .set('Accept', 'application/json') | ||
25 | |||
26 | return req.expect(200) | ||
27 | .expect('Content-Type', /json/) | ||
28 | } | ||
29 | |||
30 | function searchVideoWithPagination (url: string, search: string, start: number, count: number, sort?: string) { | ||
31 | const path = '/api/v1/search/videos' | ||
32 | |||
33 | const req = request(url) | ||
34 | .get(path) | ||
35 | .query({ start }) | ||
36 | .query({ search }) | ||
37 | .query({ count }) | ||
38 | |||
39 | if (sort) req.query({ sort }) | ||
40 | |||
41 | return req.set('Accept', 'application/json') | ||
42 | .expect(200) | ||
43 | .expect('Content-Type', /json/) | ||
44 | } | ||
45 | |||
46 | function searchVideoWithSort (url: string, search: string, sort: string) { | ||
47 | const path = '/api/v1/search/videos' | ||
48 | |||
49 | return request(url) | ||
50 | .get(path) | ||
51 | .query({ search }) | ||
52 | .query({ sort }) | ||
53 | .set('Accept', 'application/json') | ||
54 | .expect(200) | ||
55 | .expect('Content-Type', /json/) | ||
56 | } | ||
57 | |||
58 | function advancedVideosSearch (url: string, options: VideosSearchQuery) { | ||
59 | const path = '/api/v1/search/videos' | ||
60 | |||
61 | return request(url) | ||
62 | .get(path) | ||
63 | .query(options) | ||
64 | .set('Accept', 'application/json') | ||
65 | .expect(200) | ||
66 | .expect('Content-Type', /json/) | ||
67 | } | ||
68 | |||
69 | // --------------------------------------------------------------------------- | ||
70 | |||
71 | export { | ||
72 | searchVideo, | ||
73 | advancedVideosSearch, | ||
74 | searchVideoWithToken, | ||
75 | searchVideoWithPagination, | ||
76 | searchVideoWithSort | ||
77 | } | ||