X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=shared%2Fextra-utils%2Ffeeds%2Ffeeds.ts;h=ce0a98c6d65dc4a9e1e86ffe4259227f886bb257;hb=bbb3be686ad960c5b1f34a7771dec09eb1783455;hp=af6df2b208fe02b88df90b2ed2151fff6dc70dd3;hpb=94565d52bb2883e09f16d1363170ac9c0dccb7a1;p=github%2FChocobozzz%2FPeerTube.git diff --git a/shared/extra-utils/feeds/feeds.ts b/shared/extra-utils/feeds/feeds.ts index af6df2b20..ce0a98c6d 100644 --- a/shared/extra-utils/feeds/feeds.ts +++ b/shared/extra-utils/feeds/feeds.ts @@ -1,6 +1,7 @@ import * as request from 'supertest' +import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes' -type FeedType = 'videos' | 'video-comments' +type FeedType = 'videos' | 'video-comments' | 'subscriptions' function getXMLfeed (url: string, feed: FeedType, format?: string) { const path = '/feeds/' + feed + '.xml' @@ -9,18 +10,18 @@ function getXMLfeed (url: string, feed: FeedType, format?: string) { .get(path) .query((format) ? { format: format } : {}) .set('Accept', 'application/xml') - .expect(200) + .expect(HttpStatusCode.OK_200) .expect('Content-Type', /xml/) } -function getJSONfeed (url: string, feed: FeedType, query: any = {}) { +function getJSONfeed (url: string, feed: FeedType, query: any = {}, statusCodeExpected = HttpStatusCode.OK_200) { const path = '/feeds/' + feed + '.json' return request(url) .get(path) .query(query) .set('Accept', 'application/json') - .expect(200) + .expect(statusCodeExpected) .expect('Content-Type', /json/) }