Ghost/test/unit/frontend/services/theme-engine/config.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

36 lines
1.1 KiB
JavaScript

const should = require('should');
const sinon = require('sinon');
const themeConfig = require('../../../../../core/frontend/services/theme-engine/config');
describe('Themes', function () {
afterEach(function () {
sinon.restore();
});
describe('Config', function () {
it('handles no package.json', function () {
const config = themeConfig.create();
config.should.eql({posts_per_page: 5});
});
it('handles package.json without config', function () {
const config = themeConfig.create({name: 'casper'});
config.should.eql({posts_per_page: 5});
});
it('handles allows package.json to overrideg default', function () {
const config = themeConfig.create({name: 'casper', config: {posts_per_page: 3}});
config.should.eql({posts_per_page: 3});
});
it('handles ignores non-allowed config', function () {
const config = themeConfig.create({name: 'casper', config: {magic: 'roundabout'}});
config.should.eql({posts_per_page: 5});
});
});
});