2018-04-18 16:08:36 +02:00
|
|
|
import * as request from 'supertest'
|
|
|
|
import { readFileBufferPromise } from '../../../helpers/core-utils'
|
|
|
|
|
2018-06-08 20:34:37 +02:00
|
|
|
type FeedType = 'videos' | 'video-comments'
|
|
|
|
|
|
|
|
function getXMLfeed (url: string, feed: FeedType, format?: string) {
|
|
|
|
const path = '/feeds/' + feed + '.xml'
|
2018-04-18 16:08:36 +02:00
|
|
|
|
|
|
|
return request(url)
|
|
|
|
.get(path)
|
|
|
|
.query((format) ? { format: format } : {})
|
|
|
|
.set('Accept', 'application/xml')
|
|
|
|
.expect(200)
|
|
|
|
.expect('Content-Type', /xml/)
|
|
|
|
}
|
|
|
|
|
2018-06-08 20:34:37 +02:00
|
|
|
function getJSONfeed (url: string, feed: FeedType) {
|
|
|
|
const path = '/feeds/' + feed + '.json'
|
2018-04-18 16:08:36 +02:00
|
|
|
|
|
|
|
return request(url)
|
|
|
|
.get(path)
|
|
|
|
.set('Accept', 'application/json')
|
|
|
|
.expect(200)
|
|
|
|
.expect('Content-Type', /json/)
|
|
|
|
}
|
|
|
|
|
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
export {
|
|
|
|
getXMLfeed,
|
|
|
|
getJSONfeed
|
|
|
|
}
|