Ghost/core/test/unit/themes/config_spec.js
Hannah Wolfe 317daf5549 🎨 🚨 Split theme tests, clean config & add tests (#8205)
refs #7491

- split themes_spec up into several files
- clean up the code for configuration
- ensure its tested
2017-03-22 07:52:58 +01:00

39 lines
1.1 KiB
JavaScript

var should = require('should'), // jshint ignore:line
sinon = require('sinon'),
themeConfig = require('../../../server/themes/config'),
sandbox = sinon.sandbox.create();
describe('Themes', function () {
afterEach(function () {
sandbox.restore();
});
describe('Config', function () {
it('handles no package.json', function () {
var config = themeConfig.create();
config.should.eql({posts_per_page: 5});
});
it('handles package.json without config', function () {
var config = themeConfig.create({name: 'casper'});
config.should.eql({posts_per_page: 5});
});
it('handles allows package.json to overrideg default', function () {
var config = themeConfig.create({name: 'casper', config: {posts_per_page: 3}});
config.should.eql({posts_per_page: 3});
});
it('handles ignores non-allowed config', function () {
var config = themeConfig.create({name: 'casper', config: {magic: 'roundabout'}});
config.should.eql({posts_per_page: 5});
});
});
});