mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-23 02:41:50 +03:00
95d27e7f58
- 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
41 lines
1.2 KiB
JavaScript
41 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');
|
|
});
|
|
});
|