2018-10-17 10:23:56 +03:00
|
|
|
const should = require('should');
|
|
|
|
const sinon = require('sinon');
|
2020-03-30 18:26:47 +03:00
|
|
|
const themeEngines = require('../../../../../core/frontend/services/themes/engines');
|
2018-10-17 10:23:56 +03:00
|
|
|
|
|
|
|
describe('Themes: engines', function () {
|
|
|
|
afterEach(function () {
|
2019-01-21 19:53:44 +03:00
|
|
|
sinon.restore();
|
2018-10-17 10:23:56 +03:00
|
|
|
});
|
|
|
|
|
|
|
|
it('no engines', function () {
|
|
|
|
const engines = themeEngines.create();
|
|
|
|
engines.should.eql({
|
2021-02-23 17:18:32 +03:00
|
|
|
'ghost-api': 'v4'
|
2018-10-17 10:23:56 +03:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('ghost-api', function () {
|
|
|
|
it('v2', function () {
|
|
|
|
const engines = themeEngines.create({
|
|
|
|
engines: {
|
|
|
|
'ghost-api': 'v2'
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
engines.should.eql({
|
|
|
|
'ghost-api': 'v2'
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
it('v10', function () {
|
|
|
|
const engines = themeEngines.create({
|
|
|
|
engines: {
|
|
|
|
'ghost-api': 'v10'
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
engines.should.eql({
|
2021-02-23 13:38:44 +03:00
|
|
|
'ghost-api': 'v4'
|
2018-10-17 10:23:56 +03:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
it('^0.1', function () {
|
|
|
|
const engines = themeEngines.create({
|
|
|
|
engines: {
|
|
|
|
'ghost-api': '^0.1'
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
engines.should.eql({
|
2021-02-23 13:38:44 +03:00
|
|
|
'ghost-api': 'v4'
|
2018-10-17 10:23:56 +03:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
it('^2', function () {
|
|
|
|
const engines = themeEngines.create({
|
|
|
|
engines: {
|
|
|
|
'ghost-api': '^2'
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
engines.should.eql({
|
|
|
|
'ghost-api': 'v2'
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
it('2.0.0', function () {
|
|
|
|
const engines = themeEngines.create({
|
|
|
|
engines: {
|
|
|
|
'ghost-api': '2.0.0'
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
engines.should.eql({
|
|
|
|
'ghost-api': 'v2'
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
it('2.17.0', function () {
|
|
|
|
const engines = themeEngines.create({
|
|
|
|
engines: {
|
|
|
|
'ghost-api': '2.17.0'
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
engines.should.eql({
|
|
|
|
'ghost-api': 'v2'
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2019-09-03 10:03:31 +03:00
|
|
|
it('canary', function () {
|
|
|
|
const engines = themeEngines.create({
|
|
|
|
engines: {
|
|
|
|
'ghost-api': 'canary'
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
engines.should.eql({
|
|
|
|
'ghost-api': 'canary'
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2018-10-17 10:23:56 +03:00
|
|
|
it('3', function () {
|
|
|
|
const engines = themeEngines.create({
|
|
|
|
engines: {
|
|
|
|
'ghost-api': '3'
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
engines.should.eql({
|
2019-09-03 10:03:31 +03:00
|
|
|
'ghost-api': 'v3'
|
2018-10-17 10:23:56 +03:00
|
|
|
});
|
|
|
|
});
|
2019-08-09 17:25:12 +03:00
|
|
|
|
2019-09-03 10:03:31 +03:00
|
|
|
it('v3', function () {
|
2019-08-09 17:25:12 +03:00
|
|
|
const engines = themeEngines.create({
|
|
|
|
engines: {
|
2019-09-03 10:03:31 +03:00
|
|
|
'ghost-api': 'v3'
|
2019-08-09 17:25:12 +03:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
engines.should.eql({
|
2019-09-03 10:03:31 +03:00
|
|
|
'ghost-api': 'v3'
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
it('4', function () {
|
|
|
|
const engines = themeEngines.create({
|
|
|
|
engines: {
|
|
|
|
'ghost-api': '4'
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
engines.should.eql({
|
2021-02-22 17:39:48 +03:00
|
|
|
'ghost-api': 'v4'
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
it('v4', function () {
|
|
|
|
const engines = themeEngines.create({
|
|
|
|
engines: {
|
|
|
|
'ghost-api': 'v4'
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
engines.should.eql({
|
|
|
|
'ghost-api': 'v4'
|
2019-08-09 17:25:12 +03:00
|
|
|
});
|
|
|
|
});
|
2018-10-17 10:23:56 +03:00
|
|
|
});
|
|
|
|
});
|