0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-27 22:49:56 -05:00
ghost/test/unit/server/data/schema/schema.test.js
Rishabh Garg cb76b738ce
Fixed newsletter schema column validation (#14456)
refs https://github.com/TryGhost/Team/issues/1500

- newsletter schema columns were using incorrect syntax for `isIn` validations
- adds schema test to make sure schema `isIn` validations are in correct format
2022-04-11 15:05:02 +05:30

21 lines
805 B
JavaScript

const should = require('should');
const _ = require('lodash');
const schema = require('../../../../../core/server/data/schema/schema');
describe('schema validations', function () {
it('has correct isIn validation structure', async function () {
const tablesOnlyValidation = _.cloneDeep(schema);
_.each(tablesOnlyValidation, function (table) {
_.each(table, function (column) {
const columnIsInValidation = _.get(column, 'validations.isIn');
// Check column's isIn validation is in correct format
if (columnIsInValidation) {
should(columnIsInValidation).be.Array().with.length(1);
should(columnIsInValidation[0]).be.Array();
}
});
});
});
});