Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it('Icon (rss2)', () => {
hexo.config.url = 'http://example.com';
hexo.config.root = '/';
hexo.config.feed = {
type: 'rss2',
path: 'rss2.xml',
icon: 'icon.svg'
};
const feedCfg = hexo.config.feed;
const result = generator(locals, feedCfg.type, feedCfg.path);
const $ = cheerio.load(result.data);
$('rss>channel>image>url').text().should.eql(full_url_for.call(hexo, hexo.config.feed.icon));
});
}).then(data => {
data.permalink.should.eql(full_url_for.call(hexo, data.path));
hexo.config.url = 'http://yoursite.com';
return Category.removeById(data._id);
});
});
}).then(data => {
data.permalink.should.eql(full_url_for.call(hexo, slug));
hexo.config.url = 'http://yoursite.com';
return Post.removeById(data._id);
});
});
}).then(data => {
data.permalink.should.eql(full_url_for.call(hexo, data.path));
hexo.config.url = 'http://yoursite.com';
return Page.removeById(data._id);
});
});
}).then(data => {
data.permalink.should.eql(full_url_for.call(hexo, data.path));
hexo.config.url = 'http://yoursite.com';
return Tag.removeById(data._id);
});
});
return hexo._generate().then(() => checkStream(route.get(path),
full_url_for.call(hexo, path)));
});
posts = posts.filter(post => {
return post.draft !== true;
});
if (posts.length <= 0) {
feedConfig.autodiscovery = false;
return;
}
if (feedConfig.limit) posts = posts.limit(feedConfig.limit);
let url = config.url;
if (url[url.length - 1] !== '/') url += '/';
let icon = '';
if (feedConfig.icon) icon = full_url_for.call(this, feedConfig.icon);
else if (config.email) icon = gravatar(config.email);
const xml = template.render({
config,
url,
icon,
posts,
feed_url: config.root + path
});
return {
path,
data: xml
};
};
module.exports = function(path) {
return full_url_for.call(this, path);
};