diff options
Diffstat (limited to 'server/tests/utils')
-rw-r--r-- | server/tests/utils/feeds/feeds.ts | 30 | ||||
-rw-r--r-- | server/tests/utils/index.ts | 1 |
2 files changed, 31 insertions, 0 deletions
diff --git a/server/tests/utils/feeds/feeds.ts b/server/tests/utils/feeds/feeds.ts new file mode 100644 index 000000000..20e68cf3d --- /dev/null +++ b/server/tests/utils/feeds/feeds.ts | |||
@@ -0,0 +1,30 @@ | |||
1 | import * as request from 'supertest' | ||
2 | import { readFileBufferPromise } from '../../../helpers/core-utils' | ||
3 | |||
4 | function getXMLfeed (url: string, format?: string) { | ||
5 | const path = '/feeds/videos.xml' | ||
6 | |||
7 | return request(url) | ||
8 | .get(path) | ||
9 | .query((format) ? { format: format } : {}) | ||
10 | .set('Accept', 'application/xml') | ||
11 | .expect(200) | ||
12 | .expect('Content-Type', /xml/) | ||
13 | } | ||
14 | |||
15 | function getJSONfeed (url: string) { | ||
16 | const path = '/feeds/videos.json' | ||
17 | |||
18 | return request(url) | ||
19 | .get(path) | ||
20 | .set('Accept', 'application/json') | ||
21 | .expect(200) | ||
22 | .expect('Content-Type', /json/) | ||
23 | } | ||
24 | |||
25 | // --------------------------------------------------------------------------- | ||
26 | |||
27 | export { | ||
28 | getXMLfeed, | ||
29 | getJSONfeed | ||
30 | } | ||
diff --git a/server/tests/utils/index.ts b/server/tests/utils/index.ts index d7789e517..5b560ca39 100644 --- a/server/tests/utils/index.ts +++ b/server/tests/utils/index.ts | |||
@@ -13,3 +13,4 @@ export * from './videos/video-abuses' | |||
13 | export * from './videos/video-blacklist' | 13 | export * from './videos/video-blacklist' |
14 | export * from './videos/video-channels' | 14 | export * from './videos/video-channels' |
15 | export * from './videos/videos' | 15 | export * from './videos/videos' |
16 | export * from './feeds/feeds' | ||