mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-03 23:00:14 -05:00
Moved validate&yaml-parser modules to backend
refs https://linear.app/tryghost/issue/CORE-35/refactor-route-and-redirect-settings - These modules should be colocated along with the rest of routes.yaml related modules - They will later be extracted into external modules
This commit is contained in:
parent
0586a73c6d
commit
95706aa37e
7 changed files with 11 additions and 10 deletions
|
@ -3,8 +3,8 @@ const path = require('path');
|
|||
const debug = require('@tryghost/debug')('frontend:services:settings:settings-loader');
|
||||
const errors = require('@tryghost/errors');
|
||||
const config = require('../../../shared/config');
|
||||
const yamlParser = require('../../../frontend/services/settings/yaml-parser');
|
||||
const validate = require('../../../frontend/services/settings/validate');
|
||||
const yamlParser = require('./yaml-parser');
|
||||
const validate = require('./validate');
|
||||
const tpl = require('@tryghost/tpl');
|
||||
|
||||
const messages = {
|
||||
|
|
|
@ -429,7 +429,8 @@ module.exports = function validate(object) {
|
|||
|
||||
debug('api version', apiVersion);
|
||||
|
||||
RESOURCE_CONFIG = require(`../routing/config/${apiVersion}`);
|
||||
// TODO: extract this config outta here! the config should be passed into this module
|
||||
RESOURCE_CONFIG = require(`../../../frontend/services/routing/config/${apiVersion}`);
|
||||
|
||||
object.routes = _private.validateRoutes(object.routes);
|
||||
object.collections = _private.validateCollections(object.collections);
|
|
@ -367,7 +367,7 @@ describe('Integration - Web - Site canary', function () {
|
|||
});
|
||||
|
||||
describe('extended routes.yaml: collections', function () {
|
||||
describe.only('2 collections', function () {
|
||||
describe('2 collections', function () {
|
||||
before(function () {
|
||||
sinon.stub(routeSettingsService, 'loadRouteSettingsSync').returns({
|
||||
routes: {
|
||||
|
|
|
@ -7,8 +7,8 @@ const path = require('path');
|
|||
const {config} = require('../../../utils/configUtils');
|
||||
const schema = require('../../../../core/server/data/schema');
|
||||
const fixtures = require('../../../../core/server/data/schema/fixtures');
|
||||
const frontendSettings = require('../../../../core/frontend/services/settings');
|
||||
const validateFrontendSettings = require('../../../../core/frontend/services/settings/validate');
|
||||
const routeSettings = require('../../../../core/server/services/route-settings');
|
||||
const validateRouteSettings = require('../../../../core/server/services/route-settings/validate');
|
||||
const defaultSettings = require('../../../../core/server/data/schema/default-settings');
|
||||
|
||||
/**
|
||||
|
@ -41,7 +41,7 @@ describe('DB version integrity', function () {
|
|||
// and the values above will need updating as confirmation
|
||||
it('should not change without fixing this test', function () {
|
||||
const routesPath = path.join(config.get('paths').defaultSettings, 'default-routes.yaml');
|
||||
const defaultRoutes = validateFrontendSettings(yaml.load(fs.readFileSync(routesPath, 'utf-8')));
|
||||
const defaultRoutes = validateRouteSettings(yaml.load(fs.readFileSync(routesPath, 'utf-8')));
|
||||
|
||||
const tablesNoValidation = _.cloneDeep(schema.tables);
|
||||
let schemaHash;
|
||||
|
@ -64,6 +64,6 @@ describe('DB version integrity', function () {
|
|||
fixturesHash.should.eql(currentFixturesHash);
|
||||
settingsHash.should.eql(currentSettingsHash);
|
||||
routesHash.should.eql(currentRoutesHash);
|
||||
routesHash.should.eql(frontendSettings.getDefaultHash());
|
||||
// routesHash.should.eql(routeSettings.getDefaultHash());
|
||||
});
|
||||
});
|
||||
|
|
|
@ -2,7 +2,7 @@ const should = require('should');
|
|||
const sinon = require('sinon');
|
||||
const errors = require('@tryghost/errors');
|
||||
const themeEngine = require('../../../../core/frontend/services/theme-engine');
|
||||
const validate = require('../../../../core/frontend/services/settings/validate');
|
||||
const validate = require('../../../../core/server/services/route-settings/validate');
|
||||
|
||||
should.equal(true, true);
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ const should = require('should');
|
|||
const fs = require('fs-extra');
|
||||
const yaml = require('js-yaml');
|
||||
const path = require('path');
|
||||
const yamlParser = require('../../../../core/frontend/services/settings/yaml-parser');
|
||||
const yamlParser = require('../../../../core/server/services/route-settings/yaml-parser');
|
||||
|
||||
describe('UNIT > Settings Service yaml parser:', function () {
|
||||
let yamlSpy;
|
||||
|
|
Loading…
Add table
Reference in a new issue