Ghost/test/unit/frontend/meta/rss-url.test.js
Hannah Wolfe 95d27e7f58
Moved frontend unit tests into their own folder
- this is a small part of a bit of cleanup of our test files
- the goal is to make the existing tests clearer with a view to making it easier to write more tests
- this makes the test structure follow the codebase structure more closely
- eventually we will colocate the frontend tests with the frontend code
2021-10-06 11:58:29 +01:00

31 lines
823 B
JavaScript

const should = require('should');
const sinon = require('sinon');
const routing = require('../../../../core/frontend/services/routing');
const getRssUrl = require('../../../../core/frontend/meta/rss-url');
describe('getRssUrl', function () {
beforeEach(function () {
sinon.stub(routing.registry, 'getRssUrl').returns('/rss/');
});
afterEach(function () {
sinon.restore();
});
it('should return rss url', function () {
const rssUrl = getRssUrl({
secure: false
});
should.equal(rssUrl, '/rss/');
});
it('forwards absolute/secure flags', function () {
const rssUrl = getRssUrl({
secure: false
}, true);
routing.registry.getRssUrl.calledWith({secure: false, absolute: true}).should.be.true();
});
});