mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-27 22:49:56 -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>
58 lines
1.8 KiB
JavaScript
58 lines
1.8 KiB
JavaScript
const should = require('should'),
|
|
sinon = require('sinon'),
|
|
rewire = require('rewire'),
|
|
registry = rewire('../../../../core/frontend/services/routing/registry');
|
|
|
|
describe('UNIT: services/routing/registry', function () {
|
|
let getRssUrlStub;
|
|
|
|
beforeEach(function () {
|
|
getRssUrlStub = sinon.stub();
|
|
});
|
|
|
|
afterEach(function () {
|
|
sinon.restore();
|
|
});
|
|
|
|
describe('fn: getRssUrl', function () {
|
|
it('no url available', function () {
|
|
should.not.exist(registry.getRssUrl());
|
|
});
|
|
|
|
it('single collection, no index collection', function () {
|
|
registry.setRouter('CollectionRouter', {
|
|
name: 'CollectionRouter',
|
|
routerName: 'podcast',
|
|
getRssUrl: sinon.stub().returns('/podcast/rss/')
|
|
});
|
|
|
|
registry.getRssUrl().should.eql('/podcast/rss/');
|
|
});
|
|
|
|
it('single collection, no index collection, rss disabled', function () {
|
|
registry.setRouter('CollectionRouter', {
|
|
name: 'CollectionRouter',
|
|
routerName: 'podcast',
|
|
getRssUrl: sinon.stub().returns(null)
|
|
});
|
|
|
|
should.not.exist(registry.getRssUrl());
|
|
});
|
|
|
|
it('index collection', function () {
|
|
registry.setRouter('CollectionRouter', {
|
|
name: 'CollectionRouter',
|
|
routerName: 'podcast',
|
|
getRssUrl: sinon.stub().returns('/podcast/rss/')
|
|
});
|
|
|
|
registry.setRouter('CollectionRouter', {
|
|
name: 'CollectionRouter',
|
|
routerName: 'index',
|
|
getRssUrl: sinon.stub().returns('/rss/')
|
|
});
|
|
|
|
registry.getRssUrl().should.eql('/rss/');
|
|
});
|
|
});
|
|
});
|