diff options
author | Chocobozzz <me@florianbigard.com> | 2021-04-06 10:25:21 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-04-06 10:25:21 +0200 |
commit | b70025bfdc5f3d7aa3e827f6cadfa1e21483a038 (patch) | |
tree | ffb93e771305a27d9fd489af30766273897a7857 /server/tests/feeds/feeds.ts | |
parent | 0df302ca8d680652b58a0a7f606c2b383c53b1f6 (diff) | |
download | PeerTube-b70025bfdc5f3d7aa3e827f6cadfa1e21483a038.tar.gz PeerTube-b70025bfdc5f3d7aa3e827f6cadfa1e21483a038.tar.zst PeerTube-b70025bfdc5f3d7aa3e827f6cadfa1e21483a038.zip |
Remove libxmljs in favour of pure JS implem
Diffstat (limited to 'server/tests/feeds/feeds.ts')
-rw-r--r-- | server/tests/feeds/feeds.ts | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/server/tests/feeds/feeds.ts b/server/tests/feeds/feeds.ts index f1055ea44..7bad81751 100644 --- a/server/tests/feeds/feeds.ts +++ b/server/tests/feeds/feeds.ts | |||
@@ -2,7 +2,7 @@ | |||
2 | 2 | ||
3 | import 'mocha' | 3 | import 'mocha' |
4 | import * as chai from 'chai' | 4 | import * as chai from 'chai' |
5 | import * as libxmljs from 'libxmljs' | 5 | import * as xmlParser from 'fast-xml-parser' |
6 | import { | 6 | import { |
7 | addAccountToAccountBlocklist, | 7 | addAccountToAccountBlocklist, |
8 | addAccountToServerBlocklist, | 8 | addAccountToServerBlocklist, |
@@ -139,12 +139,15 @@ describe('Test syndication feeds', () => { | |||
139 | it('Should contain a valid enclosure (covers RSS 2.0 endpoint)', async function () { | 139 | it('Should contain a valid enclosure (covers RSS 2.0 endpoint)', async function () { |
140 | for (const server of servers) { | 140 | for (const server of servers) { |
141 | const rss = await getXMLfeed(server.url, 'videos') | 141 | const rss = await getXMLfeed(server.url, 'videos') |
142 | const xmlDoc = libxmljs.parseXmlString(rss.text) | 142 | expect(xmlParser.validate(rss.text)).to.be.true |
143 | const xmlEnclosure = xmlDoc.get('/rss/channel/item/enclosure') | 143 | |
144 | expect(xmlEnclosure).to.exist | 144 | const xmlDoc = xmlParser.parse(rss.text, { parseAttributeValue: true, ignoreAttributes: false }) |
145 | expect(xmlEnclosure.attr('type').value()).to.be.equal('application/x-bittorrent') | 145 | |
146 | expect(xmlEnclosure.attr('length').value()).to.be.equal('218910') | 146 | const enclosure = xmlDoc.rss.channel.item[0].enclosure |
147 | expect(xmlEnclosure.attr('url').value()).to.contain('720.torrent') | 147 | expect(enclosure).to.exist |
148 | expect(enclosure['@_type']).to.equal('application/x-bittorrent') | ||
149 | expect(enclosure['@_length']).to.equal(218910) | ||
150 | expect(enclosure['@_url']).to.contain('720.torrent') | ||
148 | } | 151 | } |
149 | }) | 152 | }) |
150 | 153 | ||