]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - server/tests/utils/feeds/feeds.ts
Correctly migrate to fs-extra
[github/Chocobozzz/PeerTube.git] / server / tests / utils / feeds / feeds.ts
CommitLineData
966eb053 1import * as request from 'supertest'
966eb053 2
fe3a55b0
C
3type FeedType = 'videos' | 'video-comments'
4
5function getXMLfeed (url: string, feed: FeedType, format?: string) {
6 const path = '/feeds/' + feed + '.xml'
966eb053
RK
7
8 return request(url)
9 .get(path)
10 .query((format) ? { format: format } : {})
11 .set('Accept', 'application/xml')
12 .expect(200)
13 .expect('Content-Type', /xml/)
14}
15
fe3a55b0
C
16function getJSONfeed (url: string, feed: FeedType) {
17 const path = '/feeds/' + feed + '.json'
966eb053
RK
18
19 return request(url)
20 .get(path)
21 .set('Accept', 'application/json')
22 .expect(200)
23 .expect('Content-Type', /json/)
24}
25
26// ---------------------------------------------------------------------------
27
28export {
29 getXMLfeed,
30 getJSONfeed
31}