/
nondefaultNamespaces-05.js
50 lines (49 loc) · 2.09 KB
/
nondefaultNamespaces-05.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
var assert = require('assert')
, FeedParser = require('../')
, feedparser = new FeedParser()
, feed = __dirname + '/feeds/unknown-namespace.atom'
, meta = {}
, articles = {}
;
describe('feedparser', function(){
describe('nondefaultnamespace Test case 3: default namespace Atom; XHTML namespace mapped to a prefix; FooML namespace default in the namespace DIV', function(){
before(function(done){
feedparser.parseFile(feed, function (error, _meta, _articles) {
assert.ifError(error);
meta = _meta;
articles = _articles;
done();
});
});
describe('article', function(){
it('should have the expected title', function() {
assert.equal(articles[0].title, 'This entry contains XHTML-looking markup that is not XHTML');
});
it('should have the expected description', function(){
assert.ok(articles[0].description.match(/^<h:div xmlns="http:\/\/hsivonen.iki.fi\/FooML">/));
assert.ok(articles[0].description.match(/<h:li>This is an XHTML list item./));
assert.ok(articles[0].description.match(/<li>This is not an XHTML list item./));
});
});
});
describe('nondefaultnamespace using static methods Test case 3: default namespace Atom; XHTML namespace mapped to a prefix; FooML namespace default in the namespace DIV', function(){
before(function(done){
FeedParser.parseFile(feed, function (error, _meta, _articles) {
assert.ifError(error);
meta = _meta;
articles = _articles;
done();
});
});
describe('article', function(){
it('should have the expected title', function() {
assert.equal(articles[0].title, 'This entry contains XHTML-looking markup that is not XHTML');
});
it('should have the expected description', function(){
assert.ok(articles[0].description.match(/^<h:div xmlns="http:\/\/hsivonen.iki.fi\/FooML">/));
assert.ok(articles[0].description.match(/<h:li>This is an XHTML list item./));
assert.ok(articles[0].description.match(/<li>This is not an XHTML list item./));
});
});
});
});