X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Ftests%2Ffeeds%2Ffeeds.ts;h=320dc33335c3713b06b96175548cd4a7f4e28f7b;hb=0cc253c9719b1e361d33d62adcef4c292cc98be9;hp=55b4348465516294ce48e73bde82ff35c6d88233;hpb=421ff4618da64f0849353383f690a014024c40da;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/tests/feeds/feeds.ts b/server/tests/feeds/feeds.ts index 55b434846..320dc3333 100644 --- a/server/tests/feeds/feeds.ts +++ b/server/tests/feeds/feeds.ts @@ -2,7 +2,8 @@ import 'mocha' import * as chai from 'chai' -import * as xmlParser from 'fast-xml-parser' +import { XMLParser, XMLValidator } from 'fast-xml-parser' +import { HttpStatusCode, VideoPrivacy } from '@shared/models' import { cleanupTests, createMultipleServers, @@ -11,9 +12,9 @@ import { makeGetRequest, PeerTubeServer, setAccessTokensToServers, + setDefaultChannelAvatar, waitJobs -} from '@shared/extra-utils' -import { HttpStatusCode, VideoPrivacy } from '@shared/models' +} from '@shared/server-commands' chai.use(require('chai-xml')) chai.use(require('chai-json-schema')) @@ -44,6 +45,7 @@ describe('Test syndication feeds', () => { }) await setAccessTokensToServers([ ...servers, serverHLSOnly ]) + await setDefaultChannelAvatar(servers[0]) await doubleFollow(servers[0], servers[1]) { @@ -149,15 +151,17 @@ describe('Test syndication feeds', () => { it('Should contain a valid enclosure (covers RSS 2.0 endpoint)', async function () { for (const server of servers) { const rss = await server.feed.getXML({ feed: 'videos' }) - expect(xmlParser.validate(rss)).to.be.true + expect(XMLValidator.validate(rss)).to.be.true - const xmlDoc = xmlParser.parse(rss, { parseAttributeValue: true, ignoreAttributes: false }) + const parser = new XMLParser({ parseAttributeValue: true, ignoreAttributes: false }) + const xmlDoc = parser.parse(rss) const enclosure = xmlDoc.rss.channel.item[0].enclosure expect(enclosure).to.exist - expect(enclosure['@_type']).to.equal('application/x-bittorrent') + + expect(enclosure['@_type']).to.equal('video/webm') expect(enclosure['@_length']).to.equal(218910) - expect(enclosure['@_url']).to.contain('720.torrent') + expect(enclosure['@_url']).to.contain('-720.webm') } }) @@ -273,8 +277,8 @@ describe('Test syndication feeds', () => { const jsonObj = JSON.parse(json) expect(jsonObj.items.length).to.be.equal(2) - expect(jsonObj.items[0].html_content).to.equal('super comment 2') - expect(jsonObj.items[1].html_content).to.equal('super comment 1') + expect(jsonObj.items[0].content_html).to.contain('

super comment 2

') + expect(jsonObj.items[1].content_html).to.contain('

super comment 1

') } })