0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-20 22:42:53 -05:00
ghost/test/unit/meta/blog-logo.test.js
Hannah Wolfe f08a55c21f
Renamed tests to .test.js & updated commands
refs: https://github.com/TryGhost/Team/issues/856
refs: https://github.com/TryGhost/Team/issues/756

- The .test.js extension is better than _spec.js as it's more obvious that it's an extension
- It also meaans we can use the --extension parameter in mocha, which should result in a better default behaviour for `yarn test`
- It also highlights that some of our tests were named incorrectly and were not (and still will not be) run (see https://github.com/TryGhost/Team/issues/856)
- Note: even with this change, `yarn test` is throwing errors, I believe because of this issue https://github.com/TryGhost/Team/issues/756
2021-07-06 20:45:01 +01:00

40 lines
1.2 KiB
JavaScript

const should = require('should');
const getBlogLogo = require('../../../core/frontend/meta/blog-logo');
const sinon = require('sinon');
const settingsCache = require('../../../core/shared/settings-cache');
describe('getBlogLogo', function () {
afterEach(function () {
sinon.restore();
});
it('should return logo if uploaded', function () {
let blogLogo;
sinon.stub(settingsCache, 'get').callsFake(function (key) {
return {
logo: '/content/images/logo.png',
icon: null
}[key];
});
blogLogo = getBlogLogo();
should.exist(blogLogo);
blogLogo.should.have.property('url', 'http://127.0.0.1:2369/content/images/logo.png');
});
it('should return custom uploaded png icon if no logo given', function () {
let blogLogo;
sinon.stub(settingsCache, 'get').callsFake(function (key) {
return {
logo: null,
icon: '/content/images/favicon.png'
}[key];
});
blogLogo = getBlogLogo();
should.exist(blogLogo);
blogLogo.should.have.property('url', 'http://127.0.0.1:2369/favicon.png');
});
});