Skip to content

Commit

Permalink
added tests for #39
Browse files Browse the repository at this point in the history
  • Loading branch information
ekalinin committed Sep 7, 2015
1 parent e660120 commit e8ed29c
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions tests/sitemap.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -524,6 +524,32 @@ module.exports = {
'</url>\n'+
'</urlset>');
},
'sitemap: normalize urls, see #39': function() {
["http://ya.ru", "http://ya.ru/"].forEach(function(hostname){
var ssp = new sm.Sitemap(null, hostname);
ssp.add("page1");
ssp.add("/page2");

ssp.toXML(function(xml) {
assert.eql(xml,
'<?xml version="1.0" encoding="UTF-8"?>\n'+
'<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" '+
'xmlns:xhtml="http://www.w3.org/1999/xhtml" '+
'xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">\n'+
'<url> '+
'<loc>http://ya.ru/page1</loc> '+
'<changefreq>weekly</changefreq> '+
'<priority>0.5</priority> '+
'</url>\n'+
'<url> '+
'<loc>http://ya.ru/page2</loc> '+
'<changefreq>weekly</changefreq> '+
'<priority>0.5</priority> '+
'</url>\n'+
'</urlset>');
});
})
},
'sitemap: langs with hostname': function() {
var smap = sm.createSitemap({
hostname: 'http://test.com',
Expand Down

0 comments on commit e8ed29c

Please sign in to comment.