Permalink
Browse files

Restore capture of entry body to fetch-feed

  • Loading branch information...
lovett committed Oct 31, 2018
1 parent 83fb933 commit 902bf87ab174c5a862493228afcd9151bcbd5949
Showing with 43 additions and 0 deletions.
  1. +1 −0 dispatcher/fetch/feed.js
  2. +42 −0 test/dispatcher/fetch-feed-spec.js
@@ -22,6 +22,7 @@ function transformItem(feedId, feedUrl, fetchId, item) {
author: item.author,
title: item.title,
guid: item.guid,
body: item.description,
url: (item.origlink || item.link),
extras: {
keywords: []
@@ -115,4 +115,46 @@ describe('fetch-feed', function() {
});
});

it('captures rss entry body when present', function (done) {
const fixture = path.join(__dirname, 'fixtures', 'rss.xml');
let storedEntries = [];

this.requestMock.replyWithFile(200, fixture, {
'Content-Type': 'application/rss+xml'
});

this.emitter.on('entry-store', (entry) => {
storedEntries.push(entry);
});

this.emitter.emit('fetch-feed', this.feedId, this.feedUrl, (err) => {
assert.ifError(err);

const entry = storedEntries[0];
assert(entry.body);
done();
});
});

it('captures atom entry body when present', function (done) {
const fixture = path.join(__dirname, 'fixtures', 'google-cloud.atom');
let storedEntries = [];

this.requestMock.replyWithFile(200, fixture, {
'Content-Type': 'application/atom+xml'
});

this.emitter.on('entry-store', (entry) => {
storedEntries.push(entry);
});

this.emitter.emit('fetch-feed', this.feedId, this.feedUrl, (err) => {
assert.ifError(err);

const entry = storedEntries[0];
assert(entry.body);
done();
});
});

});

0 comments on commit 902bf87

Please sign in to comment.