2018-06-02 21:48:23 +02:00
|
|
|
var should = require('should'),
|
2017-03-22 06:52:58 +00:00
|
|
|
sinon = require('sinon'),
|
|
|
|
|
2020-03-30 16:26:47 +01:00
|
|
|
themeConfig = require('../../../../core/frontend/services/themes/config');
|
2017-03-22 06:52:58 +00:00
|
|
|
|
|
|
|
describe('Themes', function () {
|
|
|
|
afterEach(function () {
|
2019-01-21 17:53:44 +01:00
|
|
|
sinon.restore();
|
2017-03-22 06:52:58 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
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});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|