From 90666442507b7c82f6580e6fb29c7650f850ff36 Mon Sep 17 00:00:00 2001 From: Kip Gebhardt Date: Tue, 27 Jan 2015 16:09:39 -0800 Subject: [PATCH] Test harness cleanup. Moving kqed:source assignment to plug-inable location --- lib/RssBraider.js | 11 ++++++----- package.json | 3 +-- test/index.js | 2 +- test/input_files/sample_feed.js | 1 - 4 files changed, 8 insertions(+), 9 deletions(-) diff --git a/lib/RssBraider.js b/lib/RssBraider.js index 3500b03..db02119 100644 --- a/lib/RssBraider.js +++ b/lib/RssBraider.js @@ -87,9 +87,9 @@ RssBraider.prototype.processFeed = function(feed_name, format, callback) item; while ( item = stream.read() ) { - // logger.info("item received", item.guid); - // Set kqed source - item["kqed:source"] = source.url; + if (source.url) { + item.source_url = source.url; + } var article = self.processItem(item); if (article) { source_articles.push(article); @@ -174,9 +174,9 @@ RssBraider.prototype.processItem = function (item) { ////////////////// // kqed source - if (item['kqed:source']) { + if (item.source_url) { itemOptions.custom_elements.push( - { 'kqed:source': item['kqed:source'] } + { 'kqed:source': item.source_url } ); } @@ -259,6 +259,7 @@ RssBraider.prototype.dedupe = function(articles_arr){ return _.uniq(articles_arr); }; +// Could be a plugin RssBraider.prototype.date_sort = function(articles_arr) { var sorted_articles = _.sortBy(articles_arr, function(article) { return article.date.getTime(); diff --git a/package.json b/package.json index 05f6de4..cd44919 100644 --- a/package.json +++ b/package.json @@ -21,9 +21,8 @@ "include-folder": "^0.7.0", "lodash": "^2.4.1", "mockdate": "^1.0.1", - "prova": "^2.1.1", "request": "^2.51.0", "rss": "git://github.com/rv-kip/node-rss.git#603b25", "tape": "^3.0.3" } -} +} \ No newline at end of file diff --git a/test/index.js b/test/index.js index 5849fc9..2fe69b4 100644 --- a/test/index.js +++ b/test/index.js @@ -1,6 +1,6 @@ // prova is a wrapper for tape // use npm run test:browser to run tests in a browser -var test = require('prova'), +var test = require('tape'), RssBraider = require('../index'), includeFolder = require('include-folder'), expectedOutput = includeFolder(__dirname + '/expected_output', /.*\.xml$/); diff --git a/test/input_files/sample_feed.js b/test/input_files/sample_feed.js index 53e7423..b3382cb 100644 --- a/test/input_files/sample_feed.js +++ b/test/input_files/sample_feed.js @@ -20,7 +20,6 @@ var feed = { "name" : "sample_feed", "count" : 1, "file_path" : __dirname + "/sample_feed.xml", - "categories" : ['something can go here'] }, ]