mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-02 08:13:34 +03:00
317daf5549
refs #7491 - split themes_spec up into several files - clean up the code for configuration - ensure its tested
39 lines
1.1 KiB
JavaScript
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});
|
|
});
|
|
});
|
|
});
|