mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-03 23:00:14 -05:00
7f1d3ebc07
- move all test files from core/test to test/ - updated all imports and other references - all code inside of core/ is then application code - tests are correctly at the root level - consistent with other repos/projects Co-authored-by: Kevin Ansfield <kevin@lookingsideways.co.uk>
61 lines
2.1 KiB
JavaScript
61 lines
2.1 KiB
JavaScript
const should = require('should'),
|
|
sinon = require('sinon'),
|
|
configUtils = require('../../../utils/configUtils'),
|
|
common = require('../../../../core/server/lib/common'),
|
|
controllers = require('../../../../core/frontend/services/routing/controllers'),
|
|
RSSRouter = require('../../../../core/frontend/services/routing/RSSRouter'),
|
|
urlUtils = require('../../../../core/server/lib/url-utils');
|
|
|
|
describe('UNIT - services/routing/RSSRouter', function () {
|
|
describe('instantiate', function () {
|
|
beforeEach(function () {
|
|
sinon.stub(common.events, 'emit');
|
|
sinon.stub(common.events, 'on');
|
|
|
|
sinon.spy(RSSRouter.prototype, 'mountRoute');
|
|
sinon.spy(RSSRouter.prototype, 'mountRouter');
|
|
|
|
sinon.stub(urlUtils, 'urlJoin');
|
|
});
|
|
|
|
afterEach(function () {
|
|
sinon.restore();
|
|
configUtils.restore();
|
|
});
|
|
|
|
it('default', function () {
|
|
const rssRouter = new RSSRouter();
|
|
|
|
should.exist(rssRouter.router);
|
|
rssRouter.route.value.should.eql('/rss/');
|
|
|
|
common.events.emit.calledOnce.should.be.false();
|
|
common.events.on.calledOnce.should.be.false();
|
|
|
|
rssRouter.mountRoute.callCount.should.eql(2);
|
|
|
|
rssRouter.mountRoute.args[0][0].should.eql('/rss/');
|
|
rssRouter.mountRoute.args[0][1].should.eql(controllers.rss);
|
|
|
|
rssRouter.mountRoute.args[1][0].should.eql('/feed/');
|
|
});
|
|
|
|
it('subdirectory is enabled', function () {
|
|
configUtils.set('url', 'http://localhost:22222/blog/');
|
|
const rssRouter = new RSSRouter();
|
|
|
|
should.exist(rssRouter.router);
|
|
rssRouter.route.value.should.eql('/rss/');
|
|
|
|
common.events.emit.calledOnce.should.be.false();
|
|
common.events.on.calledOnce.should.be.false();
|
|
|
|
rssRouter.mountRoute.callCount.should.eql(2);
|
|
|
|
rssRouter.mountRoute.args[0][0].should.eql('/rss/');
|
|
rssRouter.mountRoute.args[0][1].should.eql(controllers.rss);
|
|
|
|
rssRouter.mountRoute.args[1][0].should.eql('/feed/');
|
|
});
|
|
});
|
|
});
|