2020-04-29 18:44:27 +03:00
|
|
|
const should = require('should');
|
|
|
|
const sinon = require('sinon');
|
2021-04-21 16:15:50 +03:00
|
|
|
const themeConfig = require('../../../../core/frontend/services/theme-engine/config');
|
2017-03-22 09:52:58 +03:00
|
|
|
|
|
|
|
describe('Themes', function () {
|
|
|
|
afterEach(function () {
|
2019-01-21 19:53:44 +03:00
|
|
|
sinon.restore();
|
2017-03-22 09:52:58 +03:00
|
|
|
});
|
|
|
|
|
|
|
|
describe('Config', function () {
|
|
|
|
it('handles no package.json', function () {
|
2020-04-29 18:44:27 +03:00
|
|
|
const config = themeConfig.create();
|
2017-03-22 09:52:58 +03:00
|
|
|
|
|
|
|
config.should.eql({posts_per_page: 5});
|
|
|
|
});
|
|
|
|
|
|
|
|
it('handles package.json without config', function () {
|
2020-04-29 18:44:27 +03:00
|
|
|
const config = themeConfig.create({name: 'casper'});
|
2017-03-22 09:52:58 +03:00
|
|
|
|
|
|
|
config.should.eql({posts_per_page: 5});
|
|
|
|
});
|
|
|
|
|
|
|
|
it('handles allows package.json to overrideg default', function () {
|
2020-04-29 18:44:27 +03:00
|
|
|
const config = themeConfig.create({name: 'casper', config: {posts_per_page: 3}});
|
2017-03-22 09:52:58 +03:00
|
|
|
|
|
|
|
config.should.eql({posts_per_page: 3});
|
|
|
|
});
|
|
|
|
|
|
|
|
it('handles ignores non-allowed config', function () {
|
2020-04-29 18:44:27 +03:00
|
|
|
const config = themeConfig.create({name: 'casper', config: {magic: 'roundabout'}});
|
2017-03-22 09:52:58 +03:00
|
|
|
|
|
|
|
config.should.eql({posts_per_page: 5});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|