0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-03-11 02:12:21 -05:00

Fixed DB version integrity test

- We were not requiring the full path to our fixture file, and therefore we were testing the fixtures + utility functions
- This updates the test to clearly require the exact files we are checking, except the routes.yaml where we can't
- Also updates the hash to be the correct hash for just the fixture content
This commit is contained in:
Hannah Wolfe 2021-10-20 19:26:03 +01:00
parent 256f16a01f
commit 48e66d2dd6
No known key found for this signature in database
GPG key ID: 9F8C7532D0A6BA55

View file

@ -5,11 +5,13 @@ const crypto = require('crypto');
const fs = require('fs-extra');
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 schema = require('../../../../../core/server/data/schema/schema');
const fixtures = require('../../../../../core/server/data/schema/fixtures/fixtures.json');
const defaultSettings = require('../../../../../core/server/data/schema/default-settings.json');
// Routes are yaml so we can require the file directly
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');
/**
* @NOTE
@ -33,7 +35,7 @@ const defaultSettings = require('../../../../../core/server/data/schema/default-
describe('DB version integrity', function () {
// Only these variables should need updating
const currentSchemaHash = '06c1007b471faba9bb82d053f6ba6cc1';
const currentFixturesHash = 'c064a1b57c594e6a8d36f9e884df0a2a';
const currentFixturesHash = '07d4b0c4cf159b34344a6b5e88c74e9f';
const currentSettingsHash = 'aa3fcbc8ab119b630aeda7366ead5493';
const currentRoutesHash = '3d180d52c663d173a6be791ef411ed01';
@ -43,7 +45,7 @@ describe('DB version integrity', function () {
const routesPath = path.join(config.get('paths').defaultSettings, 'default-routes.yaml');
const defaultRoutes = validateRouteSettings(yaml.load(fs.readFileSync(routesPath, 'utf-8')));
const tablesNoValidation = _.cloneDeep(schema.tables);
const tablesNoValidation = _.cloneDeep(schema);
let schemaHash;
let fixturesHash;
let settingsHash;