Skip to content
Browse files

Add test for issue #23 (non-default namespaces)

  • Loading branch information...
1 parent 3b75f9e commit c9a2bd7539f637991857c5275d6a8377d2a286cc @danmactough committed Aug 30, 2012
Showing with 59 additions and 0 deletions.
  1. +31 −0 test/feeds/complexNamespaceFeed.xml
  2. +28 −0 test/nondefaultNamespaces-01.js
View
31 test/feeds/complexNamespaceFeed.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<feed xmlns="http://www.w3.org/2005/Atom">
+ <link href="http://localhost:8080/namespace/feed/" rel="current" />
+ <link href="http://localhost:8080/namespace/feed/" rel="self" />
+
+ <id>urn:uuid:9f547ffc-0b31-4794-bcb2-c00f79771738</id>
+
+ <title type="text">namespace/feed</title>
+
+ <link href="http://localhost:8080/namespace/feed/?marker=urn:uuid:d5ffaea2-0a9a-4f38-98fc-5c364177b6b4&amp;limit=25&amp;search=&amp;direction=forward" rel="previous" />
+ <link href="http://localhost:8080/namespace/feed/?marker=urn:uuid:d5ffaea2-0a9a-4f38-98fc-5c364177b6b4&amp;limit=25&amp;search=&amp;direction=backward" rel="last" />
+
+ <updated>2012-08-04T01:34:19.533Z</updated>
+
+ <p0:entry xmlns:p0="http://www.w3.org/2005/Atom" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <p0:title type="text">This is the title</p0:title>
+ <p0:author>
+ <p0:name>John Doe</p0:name>
+ </p0:author>
+
+ <p0:content type="text">Hello World</p0:content>
+
+ <p0:category term="MyCategory 1" />
+ <p0:category term="MyCategory 2" />
+ <p0:category term="MyCategory 3" />
+ <p0:link href="http://localhost:8080/namespace/feed/entries/urn:uuid:d5ffaea2-0a9a-4f38-98fc-5c364177b6b4" rel="self" />
+
+ <p0:id>urn:uuid:d5ffaea2-0a9a-4f38-98fc-5c364177b6b4</p0:id>
+ <p0:updated>2012-08-04T01:29:34.677Z</p0:updated>
+ </p0:entry>
+</feed>
View
28 test/nondefaultNamespaces-01.js
@@ -0,0 +1,28 @@
+var assert = require('assert')
+ , FeedParser = require('../')
+ , feedparser = new FeedParser()
+ , feed = __dirname + '/feeds/complexNamespaceFeed.xml'
+ , meta = {}
+ , articles = {}
+ ;
+
+describe('feedparser', function(){
+ describe('complexNamespaceFeed', function(){
+ before(function(done){
+ feedparser.parseFile(feed, function (error, _meta, _articles) {
+ assert.ifError(error);
+ meta = _meta;
+ articles = _articles;
+ done();
+ });
+ });
+ describe('articles', function(){
+ it('should contain 1 article', function() {
+ assert.deepEqual(articles.length, 1);
+ });
+ it('should have a guid equal to urn:uuid:d5ffaea2-0a9a-4f38-98fc-5c364177b6b4', function(){
+ assert.equal(articles[0].guid, 'urn:uuid:d5ffaea2-0a9a-4f38-98fc-5c364177b6b4');
+ });
+ });
+ });
+});

0 comments on commit c9a2bd7

Please sign in to comment.
Something went wrong with that request. Please try again.