UNPKG

node-feedparser

Version:
101 lines (95 loc) 4.08 kB
// Generated by IcedCoffeeScript 1.8.0-c (function() { var parser, request, should; request = require('request'); parser = require('..'); should = require('should'); describe('node-feedparser unit test', function() { it('rss without tags', function(done) { return request('http://www.u148.net/rss/', function(error, resp, body) { return parser(body, function(error, ret) { should(error).be.exactly(null); should(ret.site).have.property('title'); should(ret.site).have.property('description'); should(ret.site).have.property('date'); should(ret.site).have.property('link'); should(ret.site).have.property('author'); should(ret.items[0]).have.property('title'); should(ret.items[0]).have.property('description'); should(ret.items[0]).have.property('summary'); should(ret.items[0]).have.property('date'); should(ret.items[0]).have.property('link'); should(ret.items[0]).have.property('author'); return done(); }); }); }); it('atom without tags', function(done) { return request('http://www.ruanyifeng.com/blog/atom.xml', function(error, resp, body) { return parser(body, function(error, ret) { should(error).be.exactly(null); should(ret.site).have.property('title'); should(ret.site).have.property('description'); should(ret.site).have.property('date'); should(ret.site).have.property('link'); should(ret.site).have.property('author'); should(ret.items[0]).have.property('title'); should(ret.items[0]).have.property('description'); should(ret.items[0]).have.property('summary'); should(ret.items[0]).have.property('date'); should(ret.items[0]).have.property('link'); should(ret.items[0]).have.property('author'); return done(); }); }); }); it('rss with tags', function(done) { return request('http://www.u148.net/rss/', function(error, resp, body) { var opts; opts = { siteTags: ['title', 'date'], itemTags: ['title', 'link', 'date'] }; return parser(body, opts, function(error, ret) { should(error).be.exactly(null); should(ret.site).have.property('title'); should(ret.site).have.property('date'); should(ret.site).not.have.property('description'); should(ret.site).not.have.property('link'); should(ret.site).not.have.property('author'); should(ret.items[0]).have.property('title'); should(ret.items[0]).have.property('link'); should(ret.items[0]).have.property('date'); should(ret.items[0]).not.have.property('description'); should(ret.items[0]).not.have.property('summary'); should(ret.items[0]).not.have.property('author'); return done(); }); }); }); return it('atom with tags', function(done) { return request('http://www.ruanyifeng.com/blog/atom.xml', function(error, resp, body) { var opts; opts = { siteTags: ['title', 'date'], itemTags: ['title', 'link', 'date'] }; return parser(body, opts, function(error, ret) { should(error).be.exactly(null); should(ret.site).have.property('title'); should(ret.site).have.property('date'); should(ret.site).not.have.property('description'); should(ret.site).not.have.property('link'); should(ret.site).not.have.property('author'); should(ret.items[0]).have.property('title'); should(ret.items[0]).have.property('link'); should(ret.items[0]).have.property('date'); should(ret.items[0]).not.have.property('description'); should(ret.items[0]).not.have.property('summary'); should(ret.items[0]).not.have.property('author'); return done(); }); }); }); }); }).call(this);